[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Kent M. Pitman <KMP at MIT-MC>
- Subject: Quotient
- From: Guy.Steele at CMU-10A
- Date: Fri, 31 Jul 81 16:23:00 GMT
- Cc: moon at MIT-MC, gjc at MIT-MC, lph at MIT-MC, bug-lisp at MIT-MC, bug-lispm at MIT-MC
- In-reply-to: Kent M. Pitman's message of 31 Jul 81 02:40-EST
- Original-date: 31 July 1981 1223-EDT (Friday)
Well, it is bullshit that // and - of one argument were motivated
by hardwre considerations. How do you omit one argument to the FDVR
Extension of nonassociative operators to other than two arguments
is always a tricky business. There was confusion in FORTRAN for
quite a while over whether X/Y/Z should mean X/(Y/Z) or (X/Y)/Z = X/(Y*Z).
(FORTRAN 77 resolves this in favor of the latter.)
Now note that the definition of (QUOTIENT a b c ... z) = a/b/c/.../z
= (...((a/b)/c).../z) = a/(b*c*...*z) is not the only "natural" extension.
One could equally well define it to be a/b/c/.../z = a/(b/(c/...z)).
This is actually easier for the PDP-10 hardware given the LSUBR convention!
It is also what APL does when division-reduction is requested.
I strongly suspect that the real reason // and - are the way they are
is because of the appealing analogy to the standard infix and prefix
(i.e., binary and unary) interpretations of these operators.
Thus (- x y) = x-y
and (- x) = -x
which is certainly nice. The three-or-more-argument cases arise seldom
anyway, so I suppose consistency for that extension was not a prime
Actually, the main argument for keeping three-argument - and //
in Common LISP is mostly compatibility, while there are good
arguments against (clarity). One can just as well write (- x (+ y z))
as (- x y z). (By the way, I think old PDP-1 LISP defined - and //
to work as APL reduction does.) LISP 1.5 and InterLISP have only
two-argument quotient and difference. Opinioc