smart-if ( pred true false -- ) (original) (raw)
smart-if ( pred true false -- )
Factor handbook » The language » Combinators » Smart combinators
Prev: | keep-inputs ( quot -- ) |
---|---|
Next: | smart-when ( pred true -- ) |
Vocabulary
combinators.smart
Inputs
pred | a quotation |
---|---|
true | a quotation |
false | a quotation |
Outputs
None
Word description
A version of if that takes three quotations, where the first quotation is a predicate that preserves any inputs it consumes.
Definition
: smart-if ( pred true false -- ) [ preserving ] 2dip if ;
inline