Hi forum,
I found that (empty? my-brain) -> true.
'seq' suffices.
user=> (def sm (sorted-map 0 {:name "Alice"} 1 {:name "Bob"} 2 {:name
"Charlie"}))
#'user/sm
user=> (loop [[k v :as x] & xs] (seq sm) acc []]
(if x
(recur xs (conj acc (assoc v :id k)))
acc))
[{:name "Alice", :id 0} {:name "Bob", :id 1} {:name "Charlie", :id 2}]
I'm sorry for all the fuss.
By the by, to get the same result as the example above, what to do is
(apply vector (map (fn [[k v]] (assoc v :id k)) sm))
Regards,
Yoshinori Kohyama
--
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