Name

partition

Usage

builtin-function

Syntax

(partition size step padding seq)
(partition size step seq)
(partition size seq)

Description

Divides seq into subsequences of length size. Default step equals size. In order to get the right size, the last subsequence may borrow elements from the sequence padding.

user 1 > (partition 3 (series 10))
it: ((1 2 3) (4 5 6) (7 8 9))
user 2 > (partition 3 2 (series 10))
it: ((1 2 3) (3 4 5) (5 6 7) (7 8 9))
user 3 > (partition 3 4 (series 10))
it: ((1 2 3) (5 6 7))
user 4 > (partition 3 3 '(a b) (series 10))
it: ((1 2 3) (4 5 6) (7 8 9) (10 a b))
user 5 > (partition 3 3 '(a) (series 10))
it: ((1 2 3) (4 5 6) (7 8 9))