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 (2250, heads/master-3623a4e0d7, Nov 15 2023 18:16:06)