Skip to content

Instantly share code, notes, and snippets.

@dbasch
Last active January 2, 2016 18:39
Show Gist options
  • Save dbasch/8345191 to your computer and use it in GitHub Desktop.
Save dbasch/8345191 to your computer and use it in GitHub Desktop.
(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