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

后端 未结 7 1906
野性不改
野性不改 2020-12-12 20:13

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

7条回答
  •  爱一瞬间的悲伤
    2020-12-12 20:27

    The built-in way would simply be the function 'interleave':

    (interleave [1 2 3 4] [5 6 7 8]) => [1 5 2 6 3 7 4 8]
    

提交回复
热议问题