Handbook
Glossary
digit-groups ( n k -- seq )
Vocabulary
math
.
text
.
utils
Inputs
n
a positive integer
k
a positive integer
Outputs
seq
a
sequence
Word description
Decompose a number into groups of
k
digits and return them in a sequence starting with the least significant grouped digits first.
Definition
USING:
kernel
math
math.functions
sequences
;
IN:
math.text.utils
:
digit-groups
( n k -- seq )
[
dup
0
>
]
swap
[
10^
/mod
]
curry
produce
nip
;