Tamas Papp <tkp...@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 >> <tkp...@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.
> Note that I am not complaining about the standard, I just want to learn > the reason for this design choice so that I can take it into account when > writing my own libraries. I find (foo sequence :key #'key) much nicer than (foo (map 'sequence #'key sequence)) -- With best regards, Stas. _______________________________________________ pro mailing list pro@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro