Created
May 17, 2013 00:25
-
-
Save MichaelBlume/5596160 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 my-split-with [pred coll] | |
(let [p (promise) | |
passes ((fn step [c] | |
(lazy-seq | |
(if-let [[x & xs] (seq c)] | |
(if (pred x) | |
(cons x (step xs)) | |
(do (deliver p c) nil)) | |
(do (deliver p nil) nil)))) | |
coll)] | |
[passes | |
(lazy-seq (do (dorun passes) @p))])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment