From 14bae4cb7e75dc7d4c01ebbcb167c029012139a9 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Sun, 8 May 2011 23:11:40 +0100 Subject: [PATCH] avoid choice-point in ord-union. --- library/ordsets.yap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/ordsets.yap b/library/ordsets.yap index 3dee38aa7..b6a780bcb 100644 --- a/library/ordsets.yap +++ b/library/ordsets.yap @@ -274,8 +274,8 @@ ord_symdiff(>, Head1, Tail1, Head2, Tail2, [Head2|Difference]) :- % is true when Union is the union of Set1 and Set2. Note that when % something occurs in both sets, we want to retain only one copy. -ord_union(Set1, [], Set1) :- !. -ord_union([], Set2, Set2) :- !. +ord_union([S|Set1], [], [S|Set1]). +ord_union([], Set2, Set2). ord_union([Head1|Tail1], [Head2|Tail2], Union) :- compare(Order, Head1, Head2), ord_union(Order, Head1, Tail1, Head2, Tail2, Union).