>>>> "Hrvoje" == Hrvoje Niksic
<hniksic(a)srce.hr> writes:
Hrvoje> Martin Buchholz <martin(a)xemacs.org> writes:
> 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)
Hrvoje> No no, this is wrong. First, funcalls are very slow in Emacs, so
Hrvoje> things would slow down for a large number of argument. Second, macros
The idea would be that only the 2-arg operator actually has its own
bytecode assigned. Byte-compiled code would always use that.
Interpreted code would use a subr, as implemented and currently
commented out in data.c.
Hrvoje> lose with things such as `apply'; in CL, the following code returns
Hrvoje> non-nil if LIST is monotonous:
Hrvoje> (apply '< LIST)
I agree this has to continue to work.
Hrvoje> If we don't implement the CL functionality fully, it's better not to
Hrvoje> bother with it at all...
Doing it completely correctly is a little tricky, but worth doing.
Maybe the next time I want to learn more about the byte compiler...
Martin