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"}
([n coll]
(partition-all n n coll))
([n step coll]
(lazy-seq
(when-let [s (seq coll)]
(cons (take n s) (partition-all n step (drop step s)))))))
Comments top
No comments for partition-all. Log in to add a comment.