Skip to content

Instantly share code, notes, and snippets.

@RutledgePaulV
Created August 7, 2017 10: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 RutledgePaulV/13cf085b05968f964a2442453dae1cc2 to your computer and use it in GitHub Desktop.
Save RutledgePaulV/13cf085b05968f964a2442453dae1cc2 to your computer and use it in GitHub Desktop.
(defn zip-entries [^ZipInputStream input]
(let [last (atom nil)]
(letfn [(inner [stream]
(lazy-seq
(let [previous @last]
(when previous (.closeEntry stream))
(if-some [entry (.getNextEntry stream)]
(cons (reset! last entry) (inner stream))
(.close stream)))))]
(inner input))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment