[m-rev.] for review: set_tree234.member
Peter Wang
novalazy at gmail.com
Mon Nov 8 14:22:39 AEDT 2010
I made a list of the procedures in the set modules at the end of this
message.
---
Branches: main
library/set_tree234.m:
Swap order of arguments of `set_tree234.member/2' to match other
modules.
compiler/dead_proc_elim.m:
compiler/det_report.m:
compiler/det_util.m:
compiler/format_call.m:
compiler/inst_match.m:
compiler/llds_out_instr.m:
compiler/passes_aux.m:
compiler/post_typecheck.m:
compiler/switch_detection.m:
compiler/typecheck.m:
library/list.m:
Conform to change.
library/set.m:
library/set_ctree234.m:
library/set_ordlist.m:
library/set_unordlist.m:
Fix typos in documentation.
diff --git a/compiler/dead_proc_elim.m b/compiler/dead_proc_elim.m
index 2ab2242..81e9b17 100644
--- a/compiler/dead_proc_elim.m
+++ b/compiler/dead_proc_elim.m
@@ -318,7 +318,7 @@ dead_proc_examine(!.Queue, !.Examined, ModuleInfo, !Needed) :-
% See if the queue is empty.
( svqueue.get(Entity, !Queue) ->
% See if the next element has been examined before.
- ( set_tree234.member(!.Examined, Entity) ->
+ ( set_tree234.contains(!.Examined, Entity) ->
dead_proc_examine(!.Queue, !.Examined, ModuleInfo, !Needed)
;
set_tree234.insert(Entity, !Examined),
@@ -1030,7 +1030,7 @@ dead_pred_elim_analyze(!DeadInfo) :-
!.DeadInfo = pred_elim_info(ModuleInfo, !:Queue, !:Examined,
!:Needed, NeededNames),
( svqueue.get(PredId, !Queue) ->
- ( set_tree234.member(!.Examined, PredId) ->
+ ( set_tree234.contains(!.Examined, PredId) ->
!:DeadInfo = pred_elim_info(ModuleInfo, !.Queue, !.Examined,
!.Needed, NeededNames)
;
@@ -1131,7 +1131,7 @@ dead_pred_info_add_pred_name(Name, !DeadInfo) :-
some [!Queue, !NeededNames] (
!.DeadInfo = pred_elim_info(ModuleInfo, !:Queue, Examined,
Needed, !:NeededNames),
- ( set_tree234.member(!.NeededNames, Name) ->
+ ( set_tree234.contains(!.NeededNames, Name) ->
true
;
module_info_get_predicate_table(ModuleInfo, PredicateTable),
diff --git a/compiler/det_report.m b/compiler/det_report.m
index 5809727..fbec440 100644
--- a/compiler/det_report.m
+++ b/compiler/det_report.m
@@ -902,7 +902,7 @@ det_diagnose_missing_consids(ConsIds, Cases, MissingConsIds) :-
find_uncovered_consids([], _, !RevMissingConsIds).
find_uncovered_consids([ConsId | ConsIds], CoveredConsIds,
!RevMissingConsIds) :-
- ( set_tree234.member(CoveredConsIds, ConsId) ->
+ ( set_tree234.contains(CoveredConsIds, ConsId) ->
true
;
!:RevMissingConsIds = [ConsId | !.RevMissingConsIds]
diff --git a/compiler/det_util.m b/compiler/det_util.m
index 59ce0ee..8158f7b 100644
--- a/compiler/det_util.m
+++ b/compiler/det_util.m
@@ -143,7 +143,7 @@ delete_unreachable_cases(Cases0, PossibleConsIds, Cases) :-
delete_unreachable_cases_2([], _PossibleConsIdSet, !RevCases).
delete_unreachable_cases_2([Case0 | Cases0], PossibleConsIdSet, !RevCases) :-
Case0 = case(MainConsId0, OtherConsIds0, Goal),
- ( set_tree234.member(PossibleConsIdSet, MainConsId0) ->
+ ( set_tree234.contains(PossibleConsIdSet, MainConsId0) ->
list.filter(set_tree234.contains(PossibleConsIdSet),
OtherConsIds0, OtherConsIds),
Case = case(MainConsId0, OtherConsIds, Goal),
diff --git a/compiler/format_call.m b/compiler/format_call.m
index 8946884..e0412da 100644
--- a/compiler/format_call.m
+++ b/compiler/format_call.m
@@ -737,7 +737,7 @@ format_call_traverse_unify(Unification, CurId, !ConjMaps, !PredMap,
!RelevantVars) :-
(
Unification = assign(TargetVar, SourceVar),
- ( set_tree234.member(!.RelevantVars, TargetVar) ->
+ ( set_tree234.contains(!.RelevantVars, TargetVar) ->
set_tree234.delete(TargetVar, !RelevantVars),
set_tree234.insert(SourceVar, !RelevantVars),
ConjMap0 = get_conj_map(!.ConjMaps, CurId),
@@ -750,7 +750,7 @@ format_call_traverse_unify(Unification, CurId, !ConjMaps, !PredMap,
)
;
Unification = construct(CellVar, ConsId, ArgVars, _, _, _, _),
- ( set_tree234.member(!.RelevantVars, CellVar) ->
+ ( set_tree234.contains(!.RelevantVars, CellVar) ->
ConjMap0 = get_conj_map(!.ConjMaps, CurId),
ConjMap0 = conj_map(StringMap0, ListMap0, ElementMap0, EqvMap0),
(
diff --git a/compiler/inst_match.m b/compiler/inst_match.m
index cb4d284..51bac54 100644
--- a/compiler/inst_match.m
+++ b/compiler/inst_match.m
@@ -1372,7 +1372,7 @@ inst_is_ground(ModuleInfo, MaybeType, Inst) :-
set_tree234(mer_inst)::in, set_tree234(mer_inst)::out) is semidet.
inst_is_ground_1(ModuleInfo, MaybeType, Inst, !Expansions) :-
- ( set_tree234.member(!.Expansions, Inst) ->
+ ( set_tree234.contains(!.Expansions, Inst) ->
true
;
( Inst \= any(_, _) ->
diff --git a/compiler/llds_out_instr.m b/compiler/llds_out_instr.m
index 1df9d9f..21cd7ad 100644
--- a/compiler/llds_out_instr.m
+++ b/compiler/llds_out_instr.m
@@ -1310,7 +1310,7 @@ maybe_output_update_prof_counter(Info, Label, CallerLabel - ContLabelSet,
% is empty anyway.
ProfileTime = Info ^ lout_profile_time,
(
- set_tree234.member(ContLabelSet, Label),
+ set_tree234.contains(ContLabelSet, Label),
ProfileTime = yes
->
io.write_string("\tMR_update_prof_current_proc(MR_LABEL_AP(", !IO),
diff --git a/compiler/passes_aux.m b/compiler/passes_aux.m
index 7ae25b6..2a9316d 100644
--- a/compiler/passes_aux.m
+++ b/compiler/passes_aux.m
@@ -307,7 +307,7 @@ par_process_nonimported_procs_in_preds(ModuleInfo, Task, ValidPredIdSet,
[PredIdInfo0 | PredIdsInfos0], [PredIdInfo | PredIdsInfos]) :-
PredIdInfo0 = PredId - PredInfo0,
(
- set_tree234.member(ValidPredIdSet, PredId),
+ set_tree234.contains(ValidPredIdSet, PredId),
ProcIds = pred_info_non_imported_procids(PredInfo0),
ProcIds = [_ | _]
->
diff --git a/compiler/post_typecheck.m b/compiler/post_typecheck.m
index a6ede23..0865817 100644
--- a/compiler/post_typecheck.m
+++ b/compiler/post_typecheck.m
@@ -187,7 +187,7 @@ post_typecheck_do_finish_preds(ModuleInfo, ValidPredIdSet,
NumBadErrors, [HeadAlwaysSpecs | TailAlwaysSpecs],
[HeadNoTypeErrorSpecs | TailNoTypeErrorSpecs]) :-
PredIdInfo0 = PredId - PredInfo0,
- ( set_tree234.member(ValidPredIdSet, PredId) ->
+ ( set_tree234.contains(ValidPredIdSet, PredId) ->
post_typecheck_do_finish_pred(ModuleInfo, PredId, PredInfo0, PredInfo,
HeadNumBadErrors, HeadAlwaysSpecs, HeadNoTypeErrorSpecs)
;
diff --git a/compiler/switch_detection.m b/compiler/switch_detection.m
index 20460da..b3c96be 100644
--- a/compiler/switch_detection.m
+++ b/compiler/switch_detection.m
@@ -152,7 +152,7 @@ detect_switches_in_preds(_, _, [], []).
detect_switches_in_preds(Info, ValidPredIdSet,
[PredIdInfo0 | PredIdsInfos0], [PredIdInfo | PredIdsInfos]) :-
PredIdInfo0 = PredId - PredInfo0,
- ( set_tree234.member(ValidPredIdSet, PredId) ->
+ ( set_tree234.contains(ValidPredIdSet, PredId) ->
detect_switches_in_pred(Info, PredId, PredInfo0, PredInfo),
PredIdInfo = PredId - PredInfo
;
@@ -444,7 +444,7 @@ convert_cases_table(GoalInfo, CasesTable) = SortedCases :-
convert_case(GoalInfo, ConflictConsIds, ConsId - Entry, !Cases,
!AlreadyHandledConsIds) :-
- ( set_tree234.member(!.AlreadyHandledConsIds, ConsId) ->
+ ( set_tree234.contains(!.AlreadyHandledConsIds, ConsId) ->
Entry = cons_id_entry(State, _ArmCord),
expect(unify(State, cons_id_has_one_multi), this_file,
"convert_case: already handled but not cons_id_has_one_multi")
diff --git a/compiler/typecheck.m b/compiler/typecheck.m
index 423b74e..d6be278 100644
--- a/compiler/typecheck.m
+++ b/compiler/typecheck.m
@@ -194,7 +194,7 @@ prepare_for_typecheck(ModuleInfo, ValidPredIdSet,
[PredIdInfo0 | PredIdsInfos0], [PredIdInfo | PredIdsInfos]) :-
some [!PredInfo] (
PredIdInfo0 = PredId - !:PredInfo,
- ( set_tree234.member(ValidPredIdSet, PredId) ->
+ ( set_tree234.contains(ValidPredIdSet, PredId) ->
% Goal paths are used to identify typeclass constraints.
fill_goal_path_slots_in_clauses(ModuleInfo, no, !PredInfo),
maybe_add_field_access_function_clause(ModuleInfo, !PredInfo),
@@ -278,7 +278,7 @@ construct_type_inference_messages(ModuleInfo, ValidPredIdSet,
pred_info_get_markers(PredInfo, Markers),
(
check_marker(Markers, marker_infer_type),
- set_tree234.member(ValidPredIdSet, PredId),
+ set_tree234.contains(ValidPredIdSet, PredId),
\+ pred_info_get_goal_type(PredInfo, goal_type_promise(_))
->
Spec = construct_type_inference_message(PredInfo),
@@ -353,7 +353,7 @@ typecheck_module_one_iteration(ModuleInfo, ValidPredIdSet,
(
pred_info_is_imported(PredInfo0)
;
- not set_tree234.member(ValidPredIdSet, PredId)
+ not set_tree234.contains(ValidPredIdSet, PredId)
)
->
PredIdInfo = PredIdInfo0,
diff --git a/library/list.m b/library/list.m
index 9c098ed..4e4e5d4 100644
--- a/library/list.m
+++ b/library/list.m
@@ -1890,7 +1890,7 @@ list.remove_dups(Xs, Ys) :-
list.remove_dups_2([], _SoFar, []).
list.remove_dups_2([X | Xs], SoFar0, Zs) :-
- ( set_tree234.member(SoFar0, X) ->
+ ( set_tree234.contains(SoFar0, X) ->
list.remove_dups_2(Xs, SoFar0, Zs)
;
set_tree234.insert(X, SoFar0, SoFar),
diff --git a/library/set.m b/library/set.m
index 87b989e..1a229fd 100644
--- a/library/set.m
+++ b/library/set.m
@@ -168,7 +168,7 @@
%
:- pred set.remove_least(set(T)::in, T::out, set(T)::out) is semidet.
- % `set_union(SetA, SetB, Set)' is true iff `Set' is the union of
+ % `set.union(SetA, SetB, Set)' is true iff `Set' is the union of
% `SetA' and `SetB'. If the sets are known to be of different
% sizes, then for efficiency make `SetA' the larger of the two.
% (The current implementation using sorted lists with duplicates
diff --git a/library/set_ctree234.m b/library/set_ctree234.m
index c01ab45..ff6f550 100644
--- a/library/set_ctree234.m
+++ b/library/set_ctree234.m
@@ -157,7 +157,7 @@
:- pred set_ctree234.remove_least(T::out,
set_ctree234(T)::in, set_ctree234(T)::out) is semidet.
- % `set_ctree234(SetA, SetB) = Set' is true iff `Set' is the union
+ % `set_ctree234.union(SetA, SetB) = Set' is true iff `Set' is the union
% of `SetA' and `SetB'.
%
:- pred set_ctree234.union(set_ctree234(T)::in, set_ctree234(T)::in,
@@ -193,7 +193,7 @@
:- func set_ctree234.power_intersect(set_ctree234(set_ctree234(T)))
= set_ctree234(T).
- % `set_ctree234.intersect_list(A, B)' is true iff `B' is the
+ % `set_ctree234.intersect_list(A) = B' is true iff `B' is the
% intersection of all the sets in `A'.
%
:- func set_ctree234.intersect_list(list(set_ctree234(T))) = set_ctree234(T).
diff --git a/library/set_ordlist.m b/library/set_ordlist.m
index a725617..f046dba 100644
--- a/library/set_ordlist.m
+++ b/library/set_ordlist.m
@@ -43,7 +43,7 @@
is det.
:- func set_ordlist.sorted_list_to_set(list(T)) = set_ordlist(T).
- % A synonym for set_ordrlist.sorted_list_to_set/1.
+ % A synonym for set_ordlist.sorted_list_to_set/1.
%
:- func set_ordlist.from_sorted_list(list(T)) = set_ordlist(T).
@@ -157,7 +157,7 @@
:- pred set_ordlist.remove_least(set_ordlist(T)::in, T::out,
set_ordlist(T)::out) is semidet.
- % `set_ordlist_union(SetA, SetB, Set)' is true iff `Set' is the union
+ % `set_ordlist.union(SetA, SetB, Set)' is true iff `Set' is the union
% of `SetA' and `SetB'. The efficiency of the union operation is
% O(card(SetA)+card(SetB)) and is not sensitive to the argument
% ordering.
@@ -199,9 +199,9 @@
:- func set_ordlist.power_intersect(set_ordlist(set_ordlist(T)))
= set_ordlist(T).
- % `set_ordlist.intersect_list(A, B)' is true iff `B' is the
+ % `set_ordlist.intersect_list(A) = B' is true iff `B' is the
% intersection of all the sets in `A'.
-
+ %
:- func set_ordlist.intersect_list(list(set_ordlist(T))) = set_ordlist(T).
% `set_ordlist.difference(SetA, SetB, Set)' is true iff `Set' is the
diff --git a/library/set_tree234.m b/library/set_tree234.m
index e88c1b1..32f1c90 100644
--- a/library/set_tree234.m
+++ b/library/set_tree234.m
@@ -42,11 +42,11 @@
%
:- pred set_tree234.empty(set_tree234(_T)::in) is semidet.
- % `set_tree234.member(Set, X)' is true iff `X' is a member of `Set'.
+ % `set_tree234.member(X, Set)' is true iff `X' is a member of `Set'.
%
-:- pred set_tree234.member(set_tree234(T), T).
+:- pred set_tree234.member(T, set_tree234(T)).
:- mode set_tree234.member(in, in) is semidet.
-:- mode set_tree234.member(in, out) is nondet.
+:- mode set_tree234.member(out, in) is nondet.
% `set_tree234.is_member(Set, X, Result)' returns
% `Result = yes' iff `X' is a member of `Set'.
@@ -143,7 +143,7 @@
:- pred set_tree234.remove_least(T::out,
set_tree234(T)::in, set_tree234(T)::out) is semidet.
- % `set_tree234_union(SetA, SetB) = Set' is true iff `Set' is the union
+ % `set_tree234.union(SetA, SetB) = Set' is true iff `Set' is the union
% of `SetA' and `SetB'.
%
:- pred set_tree234.union(set_tree234(T)::in, set_tree234(T)::in,
@@ -303,9 +303,9 @@ set_tree234.empty(empty).
:- pragma promise_equivalent_clauses(set_tree234.member/2).
-set_tree234.member(Set::in, Element::out) :-
+set_tree234.member(Element::out, Set::in) :-
set_tree234.all_members(Set, Element).
-set_tree234.member(Set::in, Element::in) :-
+set_tree234.member(Element::in, Set::in) :-
set_tree234.is_member(Set, Element) = yes.
:- pred set_tree234.all_members(set_tree234(T)::in, T::out) is nondet.
diff --git a/library/set_unordlist.m b/library/set_unordlist.m
index 82e341c..5138c51 100644
--- a/library/set_unordlist.m
+++ b/library/set_unordlist.m
@@ -169,7 +169,7 @@
:- pred set_unordlist.remove_least(set_unordlist(T)::in, T::out,
set_unordlist(T)::out) is semidet.
- % `set_unordlist_union(SetA, SetB, Set)' is true iff `Set' is the union
+ % `set_unordlist.union(SetA, SetB, Set)' is true iff `Set' is the union
% of `SetA' and `SetB'. If the sets are known to be of different
% sizes, then for efficiency make `SetA' the larger of the two.
%
---
ct=set_ctree234, t=set_tree234, s=set, sv=svset, ol=set_ordlist,
ul=set_unordlist, bb=set_bbbtree
pred init(S): s ol ul bb
func init = S: ct t s ol ul bb
pred singleton_set(T,S): ct t
pred singleton_set(S,T): s ol ul bb
func make_singleton_set(T) = S: ct t s ol ul bb
pred empty(S): ct t s ol ul bb
pred non_empty(S): s
pred member(X,S): ct s ol ul bb
pred member(S,X): t
pred one_member(S,X): ct
pred is_member(X,S,b): s ol ul bb
pred is_member(S,X,b): ct t
func is_member(S,X) = b: ct t
pred contains(S,X): ct t s ol ul bb
pred least(S,X): bb
pred largest(S,X): bb
pred list_to_set([T], S): s ol ul bb
func list_to_set([T]) = S: ct t s ol ul bb
func from_list([T]) = S: s ol ul
func set([T]) = S: s
pred sorted_list_to_set([T], S): s ol ul bb
func sorted_list_to_set([T]) = S: ct t s ol ul bb
pred sorted_list_to_set_len([T],S,int): bb
func from_sorted_list([T]) = S: s ol ul bb
pred to_sorted_list(S, [T]): s ol ul bb
func to_sorted_list(S) = [T]: ct t s ol ul bb
pred equal(S,S): ct t s ol ul bb
pred subset(S,S): ct t s ol ul bb
pred superset(S,S): ct t s ol ul bb
pred insert(S,T,S): s ol ul bb
func insert(S,T) = S: s ol ul bb
pred insert(T,S,S): ct t sv
func insert(T,S) = S: ct t
pred insert_list(S,[T],S): s ol ul bb
func insert_list(S,[T]) = S: s ol ul bb
pred insert_list([T],S,S): ct t sv
func insert_list([T],S) = S: ct t
pred delete(S,T,S): s ol ul bb
func delete(S,T) = S: s ol ul bb
pred delete(T,S,S): ct t sv
func delete(T,S) = S: ct t
pred delete_list(S,[T],S): s ol ul bb
func delete_list(S,[T]) = S: s ol ul bb
pred delete_list([T],S,S): ct t sv
func delete_list([T],S) = S: ct t
pred remove(S,T,S): s ol ul bb
pred remove(T,S,S): ct t sv
pred remove_list(S,[T],S): s ol ul bb
pred remove_list([T],S,S): ct t sv
pred remove_least(S,T,S): s ol ul bb
pred remove_least(T,S,S): ct t sv
pred remove_largest(S,T,S): bb
pred union(S,S,S): ct t s ol ul bb
func union(S,S) = S: ct t s ol ul bb
pred union_list([S],S): ct t
func union_list([S]) = S: ct t s ol ul bb
pred power_union(S(S), S): ct t s ol ul bb
func power_union(S(S)) = S: ct t s ol ul bb
pred intersect(S,S,S): ct t s ol ul bb
func intersect(S,S) = S: ct t s ol ul bb
pred power_intersect(S(S), S): s ol ul bb
func power_intersect(S(S)) = S: ct t s ol ul bb
func intersect_list([S]) = S: ct t s ol ul bb
pred difference(S,S,S): ct t s ol ul bb
func difference(S,S) = S: ct t s ol ul bb
pred count(S, int): s ol
func count(S) = int: ct t s ol
pred size(S, int): bb
pred divide(P,S,S,S): ct t s ol ul
pred divide_by_set(S,S,S,S): ct t s ol
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list