Remove cuts from branch combinator.

This commit is contained in:
Simon Forman 2019-07-20 19:34:56 -07:00
parent 206f49598e
commit 1b5d1c0b82
1 changed files with 3 additions and 2 deletions

View File

@ -214,9 +214,10 @@ combo(dipd, [P, X, Y|S], S, Ei, Eo) :- append(P, [Y, X|Ei], Eo).
combo(dupdip, [P, X|S], [X|S], Ei, Eo) :- append(P, [X|Ei], Eo).
combo(branch, [T, _, true|S], S, Ei, Eo) :- !, append(T, Ei, Eo).
combo(branch, [_, F, false|S], S, Ei, Eo) :- !, append(F, Ei, Eo).
combo(branch, [T, _, true|S], S, Ei, Eo) :- append(T, Ei, Eo).
combo(branch, [_, F, false|S], S, Ei, Eo) :- append(F, Ei, Eo).
combo(branch, [T, F, Expr|S], S, Ei, Eo) :-
\+ Expr = true, \+ Expr = false,
catch( % Try Expr and do one or the other,
(Expr -> append(T, Ei, Eo) ; append(F, Ei, Eo)),
_, % If Expr don't grok, try both branches.