LIST-EXPLODE

[GENERIC-FUNCTION]


OM 6.1
Function Reference
ARGUMENTS:
  - list List [default = (1 2 3 4 5 6)]
  - nlists segment size [default = 2]

Description:

Segments <list> into <nlist> sublists of (if possible) equal length.

Ex. (list-explode '(1 2 3 4 5 6 7 8 9) 2) => ((1 2 3 4 5) (6 7 8 9))
Ex. (list-explode '(1 2 3 4 5 6 7 8 9) 5) => ((1 2) (3 4) (5 6) (7 8) (9)).

If the number of divisions exceeds the number of elements in the list, the divisions will have one element each, and remaining divisions are repeat the last division value.

Ex. (list-explode '(1 2 3 4 5 6 7 8 9) 12) => ((1) (2) (3) (4) (5) (6) (7) (8) (9) (9) (9) (9))