Handbook
Glossary
stack-find ( seq quot: ( elt -- 1/0/-1 ) -- i/f )
Vocabulary
html
.
parser
.
analyzer
Inputs
seq
a
sequence
quot
a
quotation
with stack effect
( elt -- 1/0/-1 )
Outputs
i/f
an index or
f
Word description
Takes a sequence and a quotation expected to return -1 if the element decrements the stack, 0 if it doesn't affect it and 1 if it increments it. Then finds the first element where the stack is empty.
Definition
USING:
kernel
math.statistics
sequences
;
IN:
html.parser.analyzer
:
stack-find
( seq quot: ( elt -- 1/0/-1 ) -- i/f )
map
cum-sum
0
swap
index
;
inline