smart-when* ( pred true -- )
Factor handbook > The language > Combinators > Smart combinators

Prev:smart-if* ( pred true false -- )
Next:smart-unless* ( pred false -- )


Vocabulary
combinators.smart

Inputs and outputs
preda quotation
truea quotation


Word description
A version of when that takes two quotations, where the first quotation is a predicate that preserves any inputs it consumes and the second is the true branch. If the true branch is taken, the values are left on the stack and the quotation is called. If the false branch is taken, the number of inputs inferred from predicate quotation is dropped.

Definition