Hi,
I am reading Joy of Clojure, there is the following sample in 8.1.1:
(defn contextual-eval [ctx expr]
(eval
`(let [~@(mapcat (fn [[k v]] [k `'~v]) ctx)]
~expr)))
And the sample output:
(contextual-eval {'a 1, 'b 2} '(+ a b))
;=> 3
(contextual-eval {'a 1, 'b 2} '(let [b 1000] (+ a b)))
;=> 1001
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?
Thanks for your help!
--
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