[m-dev.] for review: fix bag.m

Thomas Conway conway at cs.mu.OZ.AU
Fri Aug 27 10:37:28 AEST 1999


Hi

I spotted this bug working on some changes to appear here shortly,
but I noticed that bag__intersect is  used by termination analysis.
Given that the previous implementation was COMPLETELY bogus (I haven't
looked, but I may have written the original definintion :(), someone
who knows something about termination analysis should probably check
what effect this change has....

-- 
 Thomas Conway )O+     Every sword has two edges.
     Mercurian            <conway at cs.mu.oz.au>


library/bag.m:
	fix the implementation of bag intersection, which was
	completely bogus.

cvs diff: Diffing .
Index: bag.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/bag.m,v
retrieving revision 1.18
diff -u -r1.18 bag.m
--- bag.m	1999/03/15 08:48:04	1.18
+++ bag.m	1999/08/26 06:51:36
@@ -355,10 +355,10 @@
 bag__intersect_2(A, B, Out0, Out) :-
 	( map__remove_smallest(A, Key, AVal,A0) ->
 		( map__search(B, Key, BVal) ->
-			int__max(AVal, BVal, Val),
+			int__min(AVal, BVal, Val),
 			map__det_insert(Out0, Key, Val, Out1)
 		;
-			map__det_insert(Out0, Key, AVal, Out1)
+			Out1 = Out0
 		),
 		bag__intersect_2(A0, B, Out1, Out)
 	;
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list