Handbook
Glossary
bag-of ( quot -- seq )
Simple backtracking non-determinism
Prev:
amb-all ( quot -- )
Next:
amb ( seq -- elt )
Vocabulary
backtrack
Inputs
quot
a
quotation
with stack effect
( -- result )
Outputs
seq
a
sequence
Word description
Execute all the alternatives in the quotation and collect the results.
See also
amb-all
Definition
USING:
kernel
sequences
;
IN:
backtrack
:
bag-of
( quot -- seq )
V{
}
clone
[
[
push
]
curry
compose
amb-all
]
keep
;
inline