[m-rev.] trivial diff: use record syntax for analyser state

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Tue Apr 24 03:28:18 AEST 2001


Estimated hours taken: 0.25
Branches: main

browser/declarative_analyser.m:
	Use record syntax for the analyser state.

Index: browser/declarative_analyser.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_analyser.m,v
retrieving revision 1.7
diff -u -r1.7 declarative_analyser.m
--- browser/declarative_analyser.m	2001/04/23 16:26:26	1.7
+++ browser/declarative_analyser.m	2001/04/23 17:23:45
@@ -129,15 +129,15 @@
 				% This is the most recent node that the
 				% oracle has said is incorrect.
 				%
-			maybe(prime_suspect(T)),
+			maybe_prime	:: maybe(prime_suspect(T)),
 
 				% Current suspects.
 				%
-			list(suspect(T)),
+			suspects	:: list(suspect(T)),
 
 				% Previous prime suspects.
 				%
-			list(suspect(T))
+			previous	:: list(suspect(T))
 	).
 
 analyser_state_init(analyser(no, [], [])).
@@ -158,7 +158,7 @@
 	% suspects until last, since these generally prune the search space
 	% by the least amount.
 	%
-	Analyser0 = analyser(_, Suspects, _),
+	Suspects = Analyser0 ^ suspects,
 	(
 		find_suspicious_subterm(Answers, Suspects, Suspect, ArgPos,
 				TermPath)
@@ -292,14 +292,14 @@
 :- pred get_all_prime_suspects(analyser_state(T), list(suspect(T))).
 :- mode get_all_prime_suspects(in, out) is det.
 
-get_all_prime_suspects(analyser(MaybePrime, _, OldPrimes0), OldPrimes) :-
+get_all_prime_suspects(Analyser, OldPrimes) :-
 	(
-		MaybePrime = yes(Prime)
+		Analyser ^ maybe_prime = yes(Prime)
 	->
 		prime_suspect_get_suspect(Prime, Suspect),
-		OldPrimes = [Suspect | OldPrimes0]
+		OldPrimes = [Suspect | Analyser ^ previous]
 	;
-		OldPrimes = OldPrimes0
+		OldPrimes = Analyser ^ previous
 	).
 
 :- pred make_suspects(S, list(T), list(suspect(T)), list(decl_question))
@@ -320,12 +320,11 @@
 :- mode remove_suspects(in, in, out, in, out) is det.
 
 remove_suspects(Store, [], Response, Analyser, Analyser) :-
-	Analyser = analyser(MaybePrime, Suspects, _),
 	(
-		Suspects = []
+		Analyser ^ suspects = []
 	->
 		(
-			MaybePrime = yes(Prime)
+			Analyser ^ maybe_prime = yes(Prime)
 		->
 			prime_suspect_get_edt_node(Prime, Tree),
 			edt_root_e_bug(Store, Tree, EBug),
@@ -334,7 +333,7 @@
 			Response = no_suspects
 		)
 	;
-		list__map(suspect_get_question, Suspects, Queries),
+		list__map(suspect_get_question, Analyser ^ suspects, Queries),
 		Response = oracle_queries(Queries)
 	).
 
@@ -344,10 +343,9 @@
 	(
 		Answer = truth_value(_, yes)
 	->
-		Analyser0 = analyser(MaybePrime, Suspects0, OldPrimes),
-		find_matching_suspects(get_decl_question(Answer), Suspects0,
-				_, Suspects),
-		Analyser1 = analyser(MaybePrime, Suspects, OldPrimes),
+		find_matching_suspects(get_decl_question(Answer),
+				Analyser0 ^ suspects, _, Suspects),
+		Analyser1 = Analyser0 ^ suspects := Suspects,
 		remove_suspects(Store, Answers, Response, Analyser1, Analyser)
 	;
 		error("remove_suspects: unexpected incorrect node")
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list