list.separate

Syntax

l := list.separate(a,isize...)

Separates an iterable type (list, matrix, array, string, etc) into a list of lists. For example, an object with 12 elements can be separated into a list of 4 entries, each entry a list of size 3. This can be repeated to an arbitrary nesting depth by giving repeated sizes as arguments, with the lowest (most nested) size coming last.

For example the function:

l = list.range(1,12)
l = list.separate(l,4)

will result in l being a 3 element long list of lists of size 4, so l(1) = {1,2,3,4) and l(2) = {5,6,7,8}.

Returns:

l - the list created by separating the original iterable type into a sequence of smaller lists.

Arguments:

a - the iterable type to separate, typically a list. isize - the size of the sub lists to create from the original. This can be nested with additional arguments.