Skip to content

Partition

The collection split into consecutive, non-overlapping chunks of length n.

Partition(collection, n)the collection split into non-overlapping chunks of length `n`.
Partition(collection, n, d)overlapping sliding windows of length `n`, offset by `d` between windows.

Domain: Collections

Details
  • Flatten undoes Partition: chunking and re-flattening recovers the original list.
  • With , windows overlap; the two-argument form is equivalent to , giving non-overlapping chunks.
  • compute-engine keeps the ragged remainder instead.
  • compute-engine's Partition doesn't yet.

Examples

See also: Flatten