Welcome! Please see the About page for a little more info on how this works.

0 votes
in Collections by
edited ago by

I was expecting (partition-all n step coll) to be equal to (partition n step nil coll) but that's not always the case.

(partition-all 3 1 (range 5))
;=> ((0 1 2) (1 2 3) (2 3 4) (3 4) (4))
;; Notice the second to last partition is (3 4).  Why not stop there?

;; My work-around is to use a nil pad.  This gives my expected result
(partition 3 1 nil  (range 5))
;=> ((0 1 2) (1 2 3) (2 3 4) (3 4))

Please log in or register to answer this question.

...