find-integer ( ... n quot: ( ... i -- ... ? ) -- ... i/f )


Vocabulary
math

Inputs
nan integer
quota quotation with stack effect ( ... i -- ... ? )


Outputs
i/fan integer or f


Word description
Applies the quotation to each integer from 0 up to n, excluding n. Iteration stops when the quotation outputs a true value or the end is reached. If the quotation yields a true value for some integer, this word outputs that integer. Otherwise, this word outputs f.

Notes
This word is used to implement find.

Definition


: find-integer ( ... n quot: ( ... i -- ... ? ) -- ... i/f )
[ 0 ] 2dip find-integer-from ; inline