Using this macro, we can define a variant of if which takes a predicate quotation instead of a boolean; any values consumed by the predicate quotation are restored immediately after:
: ifte ( pred true false -- ) [ preserving ] 2dip if ; inline
Note that ifte is an ordinary word, and it passes one of its inputs to the macro. If another word calls ifte with all three input quotations literal, then ifte will be inlined and preserving will expand at compile-time, and the generated machine code will be exactly the same as if the inputs consumed by the predicate were duplicated by hand.
The ifte combinator presented here has similar semantics to the ifte combinator of the Joy programming language.