Created
January 4, 2010 21:03
-
-
Save ctdean/268862 to your computer and use it in GitHub Desktop.
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 separate-2 [f coll] | |
(loop [coll coll | |
in nil | |
out nil] | |
(if (empty? coll) | |
[(reverse in) (reverse out)] | |
(let [cur (first coll)] | |
(if (f cur) | |
(recur (rest coll) (cons cur in) out) | |
(recur (rest coll) in (cons cur out))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment