Handbook
Glossary
set-firstn ( n -- quot )
Generalized sequence words
Prev:
firstn ( n -- quot )
Next:
nappend ( n -- seq )
Vocabulary
sequences
.
generalizations
Inputs
n
an
integer
Outputs
None
Word description
A generalization of
set-first
that sets the first
n
elements of a sequence from the top
n
elements of the stack.
Definition
USING:
kernel
math
sequences
;
IN:
sequences.generalizations
MACRO:
set-firstn
( n -- quot )
[
[
drop
]
]
[
[
1
-
swap
bounds-check
2drop
]
[
set-firstn-unsafe
]
bi-curry
[
bi
]
2curry
]
if-zero
;