Created
March 16, 2012 12:44
-
-
Save mwmitchell/2049925 to your computer and use it in GitHub Desktop.
l-split-with (lazy)
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 l-split-with [i pred] | |
(lazy-seq (loop [in i out []] | |
(if-let [f (first in)] | |
(if (pred f) | |
(list out in) | |
(recur (rest in) (conj out f))))))) | |
(l-split-with [1 2 3 4 :true true] keyword?) | |
; => | |
'([1 2 3 4] (:true true)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment