I am learning Clojure and have installed Clojure 1.2.0 in an Ubuntu 11
box.
While playing with the map function I ran into some behavior I don't
understand.
I tried to use map to change a list of strings into a list of vectors
of strings, something like:
("A" "B" "C") => ( [ "A"] ["B"] ["C"])
Inlining the function does not work:
user=> (map #([ % ]) '("A" "B" "C"))
java.lang.IllegalArgumentException: Wrong number of args (0) passed
to: PersistentVector
user=>
But defining an external function does:
user=> (defn wrap [ x ] [ x ] )
#'user/wrap
user=> (map #(wrap %) '("A" "B" "C"))
(["A"] ["B"] ["C"])
user=>
can someone explain to me why this is the case?
Thanks for your help in advance!
--
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