Skip to content

Instantly share code, notes, and snippets.

@ato
Created November 29, 2009 02:51
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 ato/244769 to your computer and use it in GitHub Desktop.
Save ato/244769 to your computer and use it in GitHub Desktop.
(defn map-structure [xs [y & ys]]
(lazy-seq
(when y
(let [[head tail] (split-at (count y) xs)]
(cons head
(map-structure tail ys))))))
(map-structure [1 2 3 4] [[0] [1 1 1]])
;; => ((1) (2 3 4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment