smart-if ( pred true false -- )
Factor documentation > Factor handbook > The language > Combinators > Smart combinators
Prev:keep-inputs ( quot -- )
Next:smart-when ( pred true -- )


Vocabulary
combinators.smart

Inputs and outputs
preda quotation
truea quotation
falsea quotation


Word description
A version of if that takes three quotations, where the first quotation is a predicate that preserves any inputs it consumes.

Definition
USING: kernel ;

IN: combinators.smart

: smart-if ( pred true false -- ) [ preserving ] 2dip if ;
inline