#clojure log - Aug 24 2008

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

5:53 scook0: is there a builtin function that will take a sequence of [key val] pairs and produce a map?

5:53 (I've written my own, but it seems like the sort of thing that ought to exist already)

5:53 kotarak: apply ;) (apply hash-map (apply concat list-with-kvs-vectors))

5:57 blackdog: will zipmap work too?

5:59 kotarak: blackdog: zipmap works different: (zipmap [key1 key2] [val1 val2]) vs. (apply hash-map (apply concat [key1 val1] [key2 val2]))

6:00 oops. forget [] around the last vectors

6:00 blackdog: ok

6:00 kotarak: s/forget/forgot/

9:03 Chouser: into

9:03 (into {} [[1 2] [3 4] [5 6]]) ==> {1 2, 3 4, 5 6}

9:30 kotarak_: Chouser knows everything :)

10:01 * Chouser does not!

10:02 kotarak: But you come close. ;)

10:08 Chouser: well, *that's* true.

10:08 ha ha

10:10 Rich taught me about into when I was using reduce.

10:11 (reduce conj {} [[1 2] [3 4] [5 6]])

10:12 kotarak: I used into to convert a map into vector, IIRC. But never the other way around. I didn't even think of using it. :(

Logging service provided by n01se.net