Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
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
n
an integer
seq
a
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