#clojure logs

2008-08-24

05:53scook0is there a builtin function that will take a sequence of [key val] pairs and produce a map?
05:53scook0(I've written my own, but it seems like the sort of thing that ought to exist already)
05:53kotarakapply ;) (apply hash-map (apply concat list-with-kvs-vectors))
05:57blackdogwill zipmap work too?
05:59kotarakblackdog: zipmap works different: (zipmap [key1 key2] [val1 val2]) vs. (apply hash-map (apply concat [key1 val1] [key2 val2]))
06:00kotarakoops. forget [] around the last vectors
06:00blackdogok
06:00kotaraks/forget/forgot/
09:03Chouserinto
09:03Chouser(into {} [[1 2] [3 4] [5 6]]) ==> {1 2, 3 4, 5 6}
09:30kotarak_Chouser knows everything :)
10:02kotarakBut you come close. ;)
10:08Chouserwell, *that's* true.
10:08Chouserha ha
10:10ChouserRich taught me about into when I was using reduce.
10:11Chouser(reduce conj {} [[1 2] [3 4] [5 6]])
10:12kotarakI used into to convert a map into vector, IIRC. But never the other way around. I didn't even think of using it. :(