Handbook
Glossary
first2 ( seq -- first second )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Accessing sequence elements
Prev:
?last ( seq -- elt/f )
Next:
first3 ( seq -- first second third )
Vocabulary
sequences
Inputs
seq
a
sequence
Outputs
first
the first element
second
the second element
Word description
Pushes the first two elements of a sequence.
Errors
Throws an error if the sequence has less than two elements.
See also
first
,
last
,
last2
,
but-last
,
but-last-slice
,
rest
,
rest-slice
Definition
USING:
kernel
sequences.private
;
IN:
sequences
:
first2
( seq -- first second )
1
swap
bounds-check
nip
first2-unsafe
;
inline