[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- and / with one argument should be identity functions.
Date: 13 Nov 89 17:17:21 GMT
From: Via Fons Botman <firstname.lastname@example.org>
PLease, let's *not* define (- X) and (/ X) to be something else
than X. It might be the source of obscure errors in (admittedly
ugly) code like:
(define (net-gain gain losses) (apply - gain losses))
You should be using some version of reduce here. Apply is generally
the wrong thing to use.
Besides that, it may be cute, but it is neither clear nor
consistent, and therefore not "in the spirit of Scheme".
Why isn't it consistent? - and / are left associative and thus it is
natural and consistent to place the (right) identity on the left. :-)
Although (/ x) is atypical, that can hardly be said for -. Most
languages treat unary - specially. In addition, the "special" meaning
for both is traditional in Lisp.