Given the function
(defn replace-syms
[sym-map expr]
(let [replace #(replace-syms sym-map %)]
(cond (contains? sym-map expr) (get sym-map expr)
(list? expr) (map #(replace-syms sym-map %) expr)
(vector? expr) (into [] (map replace expr))
(map? expr) (into {} (map replace (seq expr)))
(set? expr) (set (map replace expr))
true expr)))
and the definition
(def m {:a 1 :b :a})
I'd expect the results of
(replace-syms m (vals m))
and
(replace-syms m '(1 :a))
to be the same, but they aren't:
user=> (replace-syms m (vals m))
(1 :a)
user=> (replace-syms m '(1 :a))
(1 1)
user=> (= (vals m) '(1 :a))
true
Does anyone have an explanation?
Konrad.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---