bounds-check? ( n seq -- ? )
Factor documentation > Factor handbook > The language > Collections > Sequence operations > Testing sequences
Prev:empty? ( seq -- ? )
Next:member? ( elt seq -- ? )


Vocabulary
sequences

Inputs and outputs
nan integer
seqa sequence
?a boolean


Word description
Tests if the index is within the bounds of the sequence.

Definition
IN: sequences

GENERIC# bounds-check? 1 ( n seq -- ? )


Methods
USING: kernel math sequences ;

M: integer bounds-check?
dupd length < [ 0 >= ] [ drop f ] if ; inline