first2 ( seq -- first second )
Factor documentation > Factor handbook > The language > Collections > Sequence operations > Accessing sequence elements
Prev:?last ( seq -- elt/f )
Next:first3 ( seq -- first second third )


Vocabulary
sequences

Inputs and outputs
seqa sequence
firstthe first element
secondthe second element


Word description
Pushes the first two elements of a sequence.

Errors
Throws an error if the sequence has less than two elements.

Definition
USING: kernel sequences.private ;

IN: sequences

: first2 ( seq -- first second )
1 swap bounds-check nip first2-unsafe ; inline