Is there an equivalent for the Zip function in Clojure Core or Contrib?

Posted by John Kane on Stack Overflow See other posts from Stack Overflow or by John Kane
Published on 2010-04-06T20:52:15Z Indexed on 2010/04/06 21:23 UTC
Read the original article Hit count: 267

Filed under:

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 the function is called zip. Implementing it is not difficult, but I wanted to make sure I wasn't missing a function in Core or Contrib.

There is a zip namespace in Core, but it is described as providing access to the Zipper functional technique, which does not appear to be what I am after.

Is there an equivalent function for combining 2 or more lists, in this way, in Core?

If there is not, is it because there is an idiomatic approach that renders the function unneeded?

© Stack Overflow or respective owner

Related posts about clojure