Handbook
Glossary
3if ( ..a x y z pred: ( ..a x y z -- ..b x y z ? ) true: ( ..b x y z -- ..c ) false: ( ..b x y z -- ..c ) -- ..c )
Factor handbook
»
The language
»
Combinators
»
Conditional combinators
Prev:
2if ( ..a x y pred: ( ..a x y -- ..b x y ? ) true: ( ..b x y -- ..c ) false: ( ..b x y -- ..c ) -- ..c )
Next:
1check ( ..a x quot: ( ..a x -- ..b ? ) -- ..b x ? )
Vocabulary
kernel
Inputs
x
an
object
y
an
object
z
an
object
pred
a
quotation
true
a
quotation
false
a
quotation
Outputs
None
Word description
A variant of
if
that takes a
pred
quotation. Calls
3check
on the
pred
quotation to return a boolean and preserves
x
,
y
, and
z
for the
true
or
false
branches, one of which is called.
See also
1if
,
1when
,
1unless
,
2if
,
2when
,
2unless
,
3when
,
3unless
Definition
IN:
kernel
:
3if
( ..a x y z pred: ( ..a x y z -- ..b x y z ? ) true: ( ..b x y z -- ..c ) false: ( ..b x y z -- ..c ) -- ..c )
[
3check
]
2dip
if
;
inline