On Mon, 2011-10-17 at 04:32 +0000, Guofeng Zhang wrote:
> `(let [~@(mapcat (fn [[k v]] [k `'~v]) ctx)]
>
> And the sample output:
> (contextual-eval {'a 1, 'b 2} '(+ a b))
>
> I do not understand why "`'~v" has be to used this way. If I used "`~v"
> instead (that is, remove the quote), it still works. So my question is, why
> "~v" needs to be first quoted and then syntax-quoted?
It appears to work the same in both of your samples because the numbers,
e.g. 1 and 2, are self-evaluating.
Try (contextual-eval '{a (+), b (1 2)} '(concat a b)) to see the
difference. (Hint: it should yield (+ 1 2), literally.)
--
Stephen Compall
^aCollection allSatisfy: [:each|aCondition]: less is better
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en