<n-groups> ( seq n -- groups )


Vocabulary
grouping.extras

Inputs and outputs
seqan object
nan object
groupsan object


Definition


:: <n-groups> ( seq n -- groups )
seq length :> len len n /mod :> ( step rem! ) 0 n [
dup len < [
dup step + rem zero? [ 1 + rem 1 - rem! ] unless
[ seq <slice> ] keep swap
] [ f ] if
] replicate nip ;