Skip to content

Instantly share code, notes, and snippets.

@hauntedhost
Last active February 19, 2016 15:47
Show Gist options
  • Save hauntedhost/54d8d3fee6ffa6923201 to your computer and use it in GitHub Desktop.
Save hauntedhost/54d8d3fee6ffa6923201 to your computer and use it in GitHub Desktop.
ruby to clojure
%w[a b c].reduce({}) { |accum, char| 
  accum[char.to_sym] = char * 3; accum 
}
# {:a=>"aaa", :b=>"bbb", :c=>"ccc"}
(into {} 
  (map (fn [char] [(keyword char) (apply str (repeat 3 char))]) 
    ['a 'b 'c]))
;; {:a "aaa", :b "bbb", :c "ccc"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment