Skip to content

Instantly share code, notes, and snippets.

View kitofr's full-sized avatar

Kristoffer Roupé kitofr

  • Stockholm, Sweden
View GitHub Profile
;http://4clojure.com/problem/22
#(loop [coll % cnt 0]
(if (empty? coll)
cnt
(recur (next coll) (inc cnt))))
@kitofr
kitofr / merge 2 arrays to hash
Created February 27, 2011 22:42
Merge 2 arrays into a single hash
([:a, :b, :c].zip([1,2,3])).inject({}){|res, ele| res[ele.first] = ele.last; res} #=> {:c=>3, :a=>1, :b=>2}