Skip to content

Instantly share code, notes, and snippets.

@swr1bm86
Last active October 30, 2015 10:58
Show Gist options
  • Save swr1bm86/83a3a197778dbd7311ca to your computer and use it in GitHub Desktop.
Save swr1bm86/83a3a197778dbd7311ca to your computer and use it in GitHub Desktop.
(for [[x y] (map vector '(1 2 3) '(4 5 6))]
(list x y))
=> ((1 4) (2 5) (3 6))
(for [[x y] (map vector '(1 2 3) '(4 5 6) '(7 8 9))]
(list x y))
=> ((1 4) (2 5) (3 6))
(for [[x y z] (map vector '(1 2 3) '(4 5 6) '(7 8 9))]
(list x y z))
=> ((1 4 7) (2 5 8) (3 6 9))
(for [[x y z] (map vector '(1 2 3) '(4 5 6) '(7))]
(list x y z))
=> ((1 4 7))
(def zipwith (partial map (partial conj [])))
(zipwith [1 2 3] [4 5 6] [7 8 9])
=> ([1 4 7] [2 5 8] [3 6 9])
https://www.recurse.com/blog/13-list-comprehensions-in-eight-lines-of-clojure
https://groups.google.com/forum/#!topic/comp.lang.lisp/DGkZ0Cia9Hg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment