Split a sequence by function in Clojure
Split a collection on the sequence of elements, that match it.
(defn split-by ([pred] (comp (drop-while pred) (partition-by pred) (take-nth 2))) ([pred coll] (sequence (split-by pred) coll))) ; (split-by zero? [1 0 2 0 3]) => ([1] [2] [3])