Handbook
Glossary
?lastn ( seq n -- elts... )
Vocabulary
sequences
.
generalizations
Inputs
seq
a
sequence
n
an
integer
Outputs
elts...
n
elements on the datastack
Word description
A generalization of
?last
that pushes the last
n
elements of a sequence on the stack, or
f
if the sequence is shorter than the requested number of elements.
Examples
Some core words expressed in terms of
?lastn
:
?last
1 ?lastn
Definition
USING:
kernel
sequences.padded
;
IN:
sequences.generalizations
:
?lastn
( seq n -- elts... )
[
f
<padded-head>
]
[
lastn
]
bi
;
inline