Skip to content

Instantly share code, notes, and snippets.

@jaimeagudo
Created October 19, 2017 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaimeagudo/9ff9ec47623ecfb2aa467597a547d1cb to your computer and use it in GitHub Desktop.
Save jaimeagudo/9ff9ec47623ecfb2aa467597a547d1cb to your computer and use it in GitHub Desktop.
;http://www.4clojure.com/problem/39#prob-title
(= (#(let [result (zipmap % %2)]
(apply concat result)) [1 2 3] [:a :b :c])
'(1 :a 2 :b 3 :c))
(= (#(let [result (zipmap % %2)]
(apply concat result)) [1 2] [3 4 5 6])
'(1 3 2 4))
(= (#(let [result (zipmap % %2)]
(apply concat result)) [1 2 3 4] [5])
[1 5])
(= (#(let [result (zipmap % %2)]
(apply concat result)) [30 20] [25 15])
[30 25 20 15])
; Solution
#(let [result (zipmap % %2)]
(apply concat result))
;compact version #(apply concat (zipmap % %2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment