Golf! Yeah! Here the low-level version:
(defn sift [pred coll] (letfn [(step [sep [f :as s] xs] (if (or (not s) (pred f)) (cons [sep xs] (sift pred s)) (recur sep (next s) (conj xs f))))] (lazy-seq (when-let [s (seq coll)] (step (first s) (next s) []))))) As lazy as you can get, not holding unto the head (I hope), traversing each element of the sequence only once. Sincerely Meikel PS: Since the problem is ill-specified I assume, that the first item is always a separator (for the implementors convenience). Which makes sense, since nil does not necessarily fulfill pred and I don't another "default" value. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en