[alexandria-devel] ensure-functionf

Attila Lendvai attila.lendvai at gmail.com
Mon Nov 17 11:46:14 UTC 2008


> I did not understand how you plan to use this macro. Maybe there is a
> reason you made it a macro, and not a function.
> Can you explain?

the typical use-case is a mapping function that accepts various
function designators like &key (test 'eq) (key 'identity).

if it loops a lot and it's supposed to run fast, then one should look
up the functions before looping:

(ensure-functionf test key)
(do-the-looping)

i'm open for suggestions for different naming, but i don't think that
the cl spec is so much more important than the english language and
the meaning of the "ensure" word. also, if you look at it from a
different POV, the primary feature of e.g. ENSURE-SYMBOL is to return
a symbol designated by its argument, and it's secondary that it may
need to do some sideffects to achieve that. also note that there are
already ENSURE-LIST, ENSURE-CONS, etc that do not have any sideffects.

but i'm also fully aware of the possible veto rights, so please do
live with it if anyone feels so, because otherwise the project won't
work as it was intended to...

although i would be happy if we could settle on acceptable names,
because otherwise these oneliners will end up in my duplicates.lisp
files all around in different projects.

-- 
 attila




More information about the alexandria-devel mailing list