>>>> "Hrvoje" == Hrvoje Niksic
<hniksic(a)srce.hr> writes:
Hrvoje> David Bakhash <cadet(a)bu.edu> writes:
> I'd like to request that the function `=' take &rest
args so that it
> has the potential to check equality of more than two nos.
Hrvoje> Ben (?) tried to implement CL-type arithmetic comparisons (<, > etc.)
Hrvoje> but failed because it would require changes to the byte-compiler. See
Hrvoje> the comment in src/fns.c.
That was me. I thought I could implement this in half an hour, but it
turned out to be more difficult. A general solution might involve a
macro. It's essential that 2-argument forms of the arithmetic
functions pay no performance penalty.
If macros are used to implement multi-arg functions, they need to be
defined very early, and should be clever about the nature of the args.
For example,
(= x y z)
=> (and (=2 x y) (=2 y z))
(where =2 is the ordinary 2-arg operator)
while for more complex args, we need to introduce temp vars
(= (foo x) (foo y) (foo z))
=> (let ((tmp1 (foo x))
(tmp2 (foo y)))
(and (=2 tmp1 tmp2)
(let ((tmp3 (foo z)))
(=2 (tmp2 tmp3)))))
This problem has been solved many times before. Maybe we could steal
someone else's implementation instead of reinventing the wheel.
Anyways, it's still on my TODO list.
Martin