For those who duck it in the future, there is more discussion here:
http://groups.google.com/group/clojure-dev/browse_thread/thread/f4907ebca8ef6e11
-David
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
I am puzzled by the results below. Can anyone explain the difference
in behavior?
-David
(defn mapper [f stream]
`(map ~f ~stream))
(eval (mapper #(+ 1 %) [10 11 12]))
;; - (11 12 13)
(eval (mapper (partial + 1) [10 11 12]))
;; - No matching ctor found for class clojure.core$partial...
Try this:
(eval (mapper `(partial + 1) [10 11 12]))
On Thu, Apr 14, 2011 at 9:46 AM, David McNeil mcneil.da...@gmail.comwrote:
I am puzzled by the results below. Can anyone explain the difference
in behavior?
-David
(defn mapper [f stream]
`(map ~f ~stream))
(eval (mapper #(+
Mark - Thanks. I am able to permute it to make it work. However, I
cannot explain why the original code fails.
-David
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from
I think it has to do with partial's use of apply, but you would need someone
smarter than me to tell you for sure ;)
On Thu, Apr 14, 2011 at 9:58 AM, David McNeil mcneil.da...@gmail.comwrote:
Mark - Thanks. I am able to permute it to make it work. However, I
cannot explain why the original
Actually, that doesn't seem to be the case, seems to have something to do
with the closure affecting macro expansion, but again, need someone smarter
to explain:
user (defn plus-x [x] (fn [y] (+ x y)))
#'user/plus-x
user (eval (mapper (plus-x 1) [1 2 3]))
; Evaluation aborted.
user (eval
Interesting. Thanks for your response.
On Apr 14, 10:06 am, Ken Wesson kwess...@gmail.com wrote:
On Thu, Apr 14, 2011 at 12:26 PM, Armando Blancas
armando_blan...@yahoo.com wrote:
I wonder in which cases this code is a good choice: a function that
returns uneval'ed code. Something about