group ( seq n -- array )

Factor handbook » The language » Collections » Sequence operations » Groups and clumps

Factor handbook » The language » Collections » Sequence operations » Groups and clumps

Next: | groups |

Vocabulary

grouping

Inputs

Outputs

Word description

Splits the sequence into disjoint groups of n elements and collects the groups into a new array.

Notes

If the sequence length is not a multiple of n, the final subsequence in the list will be shorter than n elements.

Examples

See also

clump, circular-clump

Definition

grouping

Inputs

seq | a sequence |

n | a non-negative integer |

Outputs

array | a sequence of sequences |

Word description

Splits the sequence into disjoint groups of n elements and collects the groups into a new array.

Notes

If the sequence length is not a multiple of n, the final subsequence in the list will be shorter than n elements.

Examples

USING: grouping prettyprint ;
{ 3 1 3 3 7 } 2 group .

{ { 3 1 } { 3 3 } { 7 } }

{ { 3 1 } { 3 3 } { 7 } }

See also

clump, circular-clump

Definition

This documentation was generated offline from a
`load-all`

image. If you want, you can also
browse the documentation from within the UI developer tools. See
the Factor website
for more information.

Factor 0.100 x86.64 (2277, heads/master-655de8d37d, Aug 7 2024 12:06:46)