Skip to content

Instantly share code, notes, and snippets.

@raek
Created May 5, 2012 12:06
Show Gist options
  • Select an option

  • Save raek/2601906 to your computer and use it in GitHub Desktop.

Select an option

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