[pro] why :key arguments?

Hans Hübner hans.huebner at gmail.com
Mon Jul 4 09:39:39 UTC 2011


On Mon, Jul 4, 2011 at 11:31 AM, Tamas Papp <tkpapp at 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).

-Hans




More information about the pro mailing list