Last active
January 2, 2016 18:39
-
-
Save dbasch/8345191 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 markers [line] | |
(concat [:start] | |
(clojure.string/split line #"\s+") | |
[:end])) | |
(defn lazy-lines [file] | |
(letfn [(helper [rdr] | |
(lazy-seq | |
(if-let [line (.readLine rdr)] | |
(concat (markers line) (helper rdr)) | |
(do (.close rdr) nil))))] | |
(helper (clojure.java.io/reader file)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment