Re: Expanding symbols and expression in macros.

2011-07-13 Thread Ken Wesson
On Wed, Jul 13, 2011 at 10:33 AM, Andrea Tortorella wrote: > I'm not an expert in macros, and maybe this is a stupid question but i > think there should be a general pattern for this. > > I' ve a function: > > (defn choose* [f & choices] >  "Applies f to one of the choices" > . .) > > And

Re: Expanding symbols and expression in macros.

2011-07-13 Thread Luc Prefontaine
(defmacro choose [[c choices] & body] `(choose* (fn [~c] ~@body) ~choices)) <--- not ~@, just ~ ~@ expects a sequence result In your first example, [:a :b :c] is a sequence but in the second example, y is not. body is a sequence (& body), using ~@ there is ok there. Luc P. On Wed, 13 Jul 201