[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: REDUCE args
From: David C. Plummer <DCP@QUABBIN.SCRC.Symbolics.COM>
Date: Fri, 25 Jul 86 09:55 EDT
From: Skef Wholey <Skef@Think.COM>
In the meantime, you can of course do something like:
(reduce #'fun (map 'vector #'key sequence))
Somebody brought up this method the last time. I had at least two
reactions: (1) It doesn't really express the intent of the programmer,
and (2) I don't care what kind of machine you are on, you should care
about efficiency and consing.
However, it is very easy to write a compiler transform that turns the
above into a call to a hidden function that does what the above does
without consing. The sequence functions are the most obvious, easiest
target for source-level optimization in a Common Lisp compiler. If the
above were listed as an idiom in the manual, then such optimizers might
appear in implementations. This is a real alternative, not some
pie-in-the-sky "a smart compiler could..." argument.
I feel the argument about consistent use of :KEY, :TEST, and :TEST-NOT
still holds. I don't object to adding a field selector argument to
REDUCE, but I don't think that it should be called :KEY. One might
introduce a new function, REDUCE-FIELD (or whatever), or a new keyword.