?first ( seq -- elt/f )
Factor handbook » The language » Collections » Sequence operations » Accessing sequence elements

Prev:fourth ( seq -- fourth )
Next:?second ( seq -- elt/f )


Vocabulary
sequences

Inputs
seqa sequence


Outputs
elt/fan object or f


Word description
A forgiving version of first. If the sequence is empty, or if the sequence is f, simply outputs f.

Examples
On an empty sequence:
USING: sequences prettyprint ; { } ?first .
f

Works like first on sequences with elements:
USING: sequences prettyprint ; { 1 2 3 } ?first .
1


Definition