Created
May 5, 2012 12:06
-
-
Save raek/2601906 to your computer and use it in GitHub Desktop.
Example of wrapping a stateful Java interface in a Clojure lazy sequence.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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