Michel S. a écrit :
>> (apply conj {} (map split-kv (split-pairs test-str)))
>>
>>     
> The last can be simplified by using into:
> (into {} (map split-kv (split-pairs test-str)))
>   

It should be noted that into (and conj) is somewhat tricky with maps:
user=> (into {} '({1 2} {3 4}))
{3 4, 1 2}
user=> (into {} '([1 2] [3 4]))
{3 4, 1 2}
user=> (into {} '((1 2) (3 4)))
java.lang.ClassCastException: java.lang.Integer cannot be cast to 
java.util.Map$Entry (NO_SOURCE_FILE:0)

It bit me before.

Christophe

-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (en)



--~--~---------~--~----~------------~-------~--~----~
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