3guard ( ..a x y z quot: ( ..a x y z -- ..b ? ) -- ..b x/f y/f z/f )
Factor handbook » The language » Combinators » Conditional combinators

Prev:2guard ( ..a x y quot: ( ..a x y -- ..b ? ) -- ..b x/f y/f )
Next:? ( ? true false -- true/false )


Vocabulary
kernel

Inputs
xan object
yan object
zan object
quota quotation


Outputs
x/fan object
y/fan object
z/fan object


Word description
Calls quot on x, y, and z and either keeps x, y, and z or replaces them with f.

Examples
True case:
USING: kernel math prettyprint ; 3 4 5 [ + + even? ] 3guard [ . ] tri@
3 4 5

False case:
USING: kernel math prettyprint ; 3 4 5 [ + + odd? ] 3guard [ . ] tri@
f f f


See also
1check, 1guard, 2check, 2guard, 3check

Definition

: 3guard
( ..a x y z quot: ( ..a x y z -- ..b ? ) -- ..b x/f y/f z/f )
3check [ 3drop f f f ] unless ; inline