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
(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