Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@raek
Created May 5, 2012 12:06
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 raek/2601906 to your computer and use it in GitHub Desktop.
Save raek/2601906 to your computer and use it in GitHub Desktop.
Example of wrapping a stateful Java interface in a Clojure lazy sequence.
(defn iterator-seq [it]
(lazy-seq
(when (.hasNext it)
(cons (.next it)
(iterator-seq it)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment