Skip to content

Instantly share code, notes, and snippets.

@ctdean
Created January 4, 2010 21:03
Show Gist options
  • Save ctdean/268862 to your computer and use it in GitHub Desktop.
Save ctdean/268862 to your computer and use it in GitHub Desktop.
(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