Handbook
Glossary
?first4 ( seq -- first/f second/f third/f fourth/f )
Vocabulary
sequences
.
extras
Inputs
seq
a
sequence
Outputs
first/f
an
object
second/f
an
object
third/f
an
object
fourth/f
an
object
Word description
Pushes the first four elements of
seq
. Pushes
f
for missing elements.
Definition
USING:
combinators
kernel
sequences
sequences.private
;
IN:
sequences.extras
:
?first4
( seq -- first/f second/f third/f fourth/f )
dup
length
{
{
0
[
drop
f
f
f
f
]
}
{
1
[
first-unsafe
f
f
f
]
}
{
2
[
first2-unsafe
f
f
]
}
{
3
[
first3-unsafe
f
]
}
[
drop
first4-unsafe
]
}
case
;