From 1b5d1c0b82be542644690509c4d205d1d39d15af Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Sat, 20 Jul 2019 19:34:56 -0700 Subject: [PATCH] Remove cuts from branch combinator. --- thun/thun.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/thun/thun.pl b/thun/thun.pl index 0553a71..3b803ce 100644 --- a/thun/thun.pl +++ b/thun/thun.pl @@ -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.