[alexandria-devel] ensure-functionf

Faré fahree at gmail.com
Sun Nov 16 17:17:34 UTC 2008


2008/11/16 Attila Lendvai <attila.lendvai at gmail.com>:
> dear list,
>
> i've got this patch pending:
>
> (defmacro ensure-functionf (&rest places)
>  "Call ENSURE-FUNCTION for each place in PLACES and store back the results."
>  `(progn
>     ,@(mapcar (lambda (place)
>                 `(setf ,place (ensure-function ,place)))
>               places)))
>
> it might be controversial, so i'll first send it here. if noone
> complains for a week or two, then i'll push it eventually.

Shouldn't you be using define-modify-macro and/or setf-macro-expander for that?

e.g.
(define-macro-expander ensure-functionf/1 (x) ensure-function)
(defmacro ensure-functionf (&rest places)
  `(progn ,@(mapcar (lambda (x) `(ensure-functionf/1 ,x)))))

[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
Suicidal terrorists may have short shelf lives.  -- John McCarthy




More information about the alexandria-devel mailing list