Handbook
Glossary
ensure-d ( n -- values )
Vocabulary
stack-checker
.
backend
Inputs
n
an
integer
Outputs
values
a
sequence
Word description
Makes sure there is room for at least
n
items in
meta-d
starting from
inner-d-index
. Modifies
meta-d
and
inner-d-index
. Returns the last
n
items of
meta-d
.
Definition
USING:
arrays
kernel
math
sequences
stack-checker.state
;
IN:
stack-checker.backend
:
ensure-d
( n -- values )
meta-d
2dup
length
>
[
2dup
[
nip
>array
]
[
length
-
make-values
]
[
nip
delete-all
]
2tri
[
introduce-values
]
[
meta-d
push-all
]
bi
meta-d
push-all
]
when
swap
from-tail
[
tail
]
[
update-inner-d
]
bi
;