bounds-check ( n seq -- n seq ) - Factor Documentation

bounds-check ( n seq -- n seq )


Vocabulary
sequences

Inputs
n an integer
seq a sequence


Outputs
n an integer
seq a sequence


Word description
Throws an error if n is negative or if it is greater than or equal to the length of seq. Otherwise the two inputs remain on the stack.

Definition
USING: kernel ;

IN: sequences

: bounds-check ( n seq -- n seq )
[ bounds-check? ] 2check [ bounds-error ] unless ; inline

AltStyle によって変換されたページ (->オリジナル) /