Skip to content

Instantly share code, notes, and snippets.

@RobinRamael
Created January 30, 2011 16:19
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 RobinRamael/802982 to your computer and use it in GitHub Desktop.
Save RobinRamael/802982 to your computer and use it in GitHub Desktop.
(defn interweave [list1 list2]
(loop [s1 (lazy-seq list1) s2 (lazy-seq list2) out (empty s1)]
(cond
(empty? s1) (concat out s2)
(empty? s2) (concat out s1)
:else (recur (rest s1)
(rest s2)
(concat out (seq (list (first s1) (first s2)))))))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment