Handbook
Glossary
if-amb ( true false -- ? )
Simple backtracking non-determinism
Next:
amb-all ( quot -- )
Vocabulary
backtrack
Inputs
true
a
quotation
with stack effect
( -- ? )
false
a
quotation
Outputs
?
a
boolean
Word description
Execute the first quotation and return
t
if it returns
t
itself. If it fails with
fail
or returns
f
, then the second quotation is executed and
f
is returned.
Definition
USING:
backtrack.private
kernel
;
IN:
backtrack
:
if-amb
( true false -- ? )
[
[
{
t
f
}
amb
]
[
[
must-be-true
t
]
compose
]
[
[
f
]
compose
]
tri*
if
]
amb-preserve
;
inline