DEPRECATED. Prefer clojure.core version.
Applies f to each value in coll, splitting it each time f returns
a new value. Returns a lazy seq of lazy seqs.
(defn partition-by
"DEPRECATED. Prefer clojure.core version.
Applies f to each value in coll, splitting it each time f returns
a new value. Returns a lazy seq of lazy seqs."
{:deprecated "1.2"}
[f coll]
(when-let [s (seq coll)]
(let [fst (first s)
fv (f fst)
run (cons fst (take-while #(= fv (f %)) (rest s)))]
(lazy-seq
(cons run (partition-by f (drop (count run) s)))))))
Comments top
No comments for partition-by. Log in to add a comment.