smart-loop ( ..a quot: ( ..a -- ..b ? ) -- ..b ) (original) (raw)
smart-loop ( ..a quot: ( ..a -- ..b ? ) -- ..b )
Vocabulary
combinators.smart
Inputs
quot | a quotation with stack effect ( ..a -- ..b ? ) |
---|
Outputs
None
Word description
A version of loop that runs until the quot returns f and leaves the result of the quotation on the stack.
Definition
USING: generalizations kernel ;
: smart-loop ( ..a quot: ( ..a -- ..b ? ) -- ..b )
dup outputs [ ndrop ] curry while* ; inline