Skip to content

Instantly share code, notes, and snippets.

@neilmock
Created December 4, 2009 02:00
Show Gist options
  • Save neilmock/248776 to your computer and use it in GitHub Desktop.
Save neilmock/248776 to your computer and use it in GitHub Desktop.
;; i have a vector [1 2 3]
;; i want to produce a hash map as follows:
;; {1 <1 + 1> 2 <2 + 1> 3 <3 + 1>}
;; {1 2, 2 3, 3 4}
(reduce (fn [m x] (assoc m x (+ x 1))) {} [1 2 3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment