In Clojure, I want to combine two lists to give a list of pairs,
> (zip \'(1 2 3) \'(4 5 6))
((1 4) (2 5) (3 6))
In Haskell or Ruby t
to give you exactly what you wanted, mapping list
across the two lists will give you a list of lists like in your example. I think that many Clojurians would tend to use vectors for this though it will work with anything. and the inputs do not need to be the same type. map creates seqs from them and then maps the seqs so any seq'able input will work fine.
(map list '(1 2 3) '(4 5 6))
(map list [1 2 3] '(4 5 6))
(map hash-map '(1 2 3) '(4 5 6))
(map hash-set '(1 2 3) '(4 5 6))