Hi all. Is this a bug or a feature? When I bind the var *num* to a new
value, in one case it appears the lambda uses the original value, not
the newly bound one.

(def *num* 16)

(defn f1 []
 ( map (fn [x]  *num* ) [1]))


(defn f2 []           ;; same as f1 but calls first on the map
 (first
  ( map (fn [x]  *num* ) [1])))


user> (f1)
(16)                                                       <--ok
user> (f2)
16                                                         <--ok
user> (binding [*num* 1024] (f1))
(16)                                                      <-- expected 1024
user> (binding [*num* 1024] (f2))
1024                                                     <--ok after
all, in spite of the fact the above gave list (16)

Thanks,
Hugh

--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to