(search) ( ... seq from to quot: ( ... elt -- ... <=> ) -- ... i elt )


Vocabulary
binary-search.private

Inputs
seqan object
froman object
toan object
quota quotation with stack effect ( ... elt -- ... <=> )


Outputs
ian object
eltan object


Definition


:: (search)
( ... seq from to quot: ( ... elt -- ... <=> ) -- ... i elt )
from to + 2/ :> midpoint midpoint seq nth-unsafe
:> elt to from - 1 <=
[ midpoint elt ] [
elt quot call {
{ +lt+ [ seq from midpoint quot (search) ] }
{ +gt+ [ seq midpoint to quot (search) ] }
{ +eq+ [ midpoint elt ] }
} case
] if ; inline recursive