On Mon, 04 Jul 2011 14:20:32 +0400, Stas Boukarev wrote:
Tamas Papp tkpapp@gmail.com writes:
On Mon, 04 Jul 2011 11:39:39 +0200, Hans Hübner wrote:
On Mon, Jul 4, 2011 at 11:31 AM, Tamas Papp tkpapp@gmail.com wrote:
Why do some CL library functions have :key arguments?
[...]
but it is a bit cumbersome. I can make my code simpler by relying on calls like
(quantiles (map 'vector key vector) quantiles)
This not only conses "a bit more", it also duplicates traversal efforts - The original list must be traversed, and the consed-up list of key values as well. I think it is prudent that the CL library functions offer ways to reduce consing for cases where "a bit" is too much (and "a bit" can become a lot if a program operates on long lists).
I understand this. My main question is: why not do this with compiler macros? Is there any reason for this, other than historical?
Because it's not easy to do with compiler macros.
Can you (or someone) please elaborate on that? I have just started reading up on compiler macros, and I don't understand why.
Thanks,
Tamas