Skip to content

Instantly share code, notes, and snippets.

@pervognsen
Created March 19, 2010 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pervognsen/337474 to your computer and use it in GitHub Desktop.
Save pervognsen/337474 to your computer and use it in GitHub Desktop.
(defn sift [p xs]
(when (seq xs)
(lazy-seq
(let [[as bs] (split-with p xs)
[cs ds] (split-with (comp not p) bs)]
(cons [as cs] (sift p ds))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment