Skip to content

Partition

Breaks a list into smaller sublists.

$ wo 'Partition[{1, 2, 3, 4}, 2]'
{{1, 2}, {3, 4}}

A sixth argument is the head every block is wrapped in instead of List:

$ wo 'Partition[{1, 2, 3, 4}, 2, 2, 1, {}, f]'
{f[1, 2], f[3, 4]}