Returns a lazy sequence of lists like partition, but may include
partitions with fewer than n items at the end.
(defn partition-all
"Returns a lazy sequence of lists like partition, but may include
partitions with fewer than n items at the end."
{:added "1.2"
:static true}
([n coll]
(partition-all n n coll))
([n step coll]
(lazy-seq
(when-let [s (seq coll)]
(let [seg (doall (take n s))]
(cons seg (partition-all n step (nthrest s step))))))))
Comments top
No comments for partition-all. Log in to add a comment.