[m-rev.] diff: change argument ordering in tree_bitset module
Julien Fischer
juliensf at csse.unimelb.edu.au
Fri May 20 02:19:43 AEST 2011
Branches: main
Change the argument order of predicates in the tree_bitset module to make it
more conducive to the use of state variable notation.
library/tree_bitset.m:
As above.
Add the usual modes with (mostly-)unique accumulators
to foldl/4.
compiler/quantification.m:
Conform to the above change.
NEWS:
Announce the above change.
Julien.
Index: NEWS
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/NEWS,v
retrieving revision 1.574
diff -u -r1.574 NEWS
--- NEWS 19 May 2011 13:11:44 -0000 1.574
+++ NEWS 19 May 2011 16:13:38 -0000
@@ -68,8 +68,10 @@
sparse_bitset.delete_list/3, sparse_bitset.remove/3,
sparse_bitset.remove_list/3, sparse_bitset.remove_leq/3,
sparse_bitset.remove_gt/3, sparse_bitset.remove_least/3,
- tree234.set/4, tree234.remove/4, tree234.remove_smallest/4 and
- tree234.update/4.
+ tree234.set/4, tree234.remove/4, tree234.remove_smallest/4,
+ tree234.update/4, tree_bitset.insert/3, tree_bitset.insert_list/3,
+ tree_bitset.delete/3, tree_bitset.delete_list/3, tree_bitset.remove/3,
+ tree_bitset.remove_list/3 and tree_bitset.remove_least/3
* We have add the following new functions for creating singleton
maps: bimap.singleton/2, injection.singleton/2, map.singleton/2,
@@ -143,7 +145,7 @@
stack and pqueue modules.)
* We have added additional modes with unique and mostly-unique accumulators
- to rbtree.foldl/4 and rbtree.foldl2/6.
+ to rbtree.foldl/4, rbtree.foldl2/6 and tree_bitset.foldl/4.
NEWS for Mercury 11.01
Index: compiler/quantification.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/quantification.m,v
retrieving revision 1.142
diff -u -r1.142 quantification.m
--- compiler/quantification.m 2 Jan 2011 14:37:58 -0000 1.142
+++ compiler/quantification.m 19 May 2011 14:35:56 -0000
@@ -371,7 +371,7 @@
% The switch variable is guaranteed to be nonlocal to the switch, since
% it has to be bound elsewhere, so we put it in the nonlocals here.
union_list(NonLocalVarSets, NonLocalVars0),
- insert(NonLocalVars0, Var, NonLocalVars),
+ insert(Var, NonLocalVars0, NonLocalVars),
set_nonlocals(NonLocalVars, !Info),
GoalExpr = switch(Var, Det, Cases),
goal_expr_vars_bitset(NonLocalsToRecompute, GoalExpr0,
@@ -423,7 +423,7 @@
rename_some_vars_in_goal(RenameMap, Then0, Then1),
rename_var_list(need_not_rename, RenameMap, Vars0, Vars)
),
- insert_list(QuantVars, Vars, QuantVars1),
+ insert_list(Vars, QuantVars, QuantVars1),
(
NonLocalsToRecompute = ordinary_nonlocals_maybe_lambda,
goal_vars_both_maybe_lambda(NonLocalsToRecompute, Then1,
@@ -528,25 +528,25 @@
NonLocalsToRecompute, !Info),
GoalExpr = unify(Var, UnifyRHS, Mode, Unification, UnifyContext),
get_nonlocals(!.Info, VarsUnifyRHS),
- insert(VarsUnifyRHS, Var, GoalVars0),
- insert_list(GoalVars0, TypeInfoVars, GoalVars1),
+ insert(Var, VarsUnifyRHS, GoalVars0),
+ insert_list(TypeInfoVars, GoalVars0, GoalVars1),
(
MaybeReuseVar = yes(ReuseVar),
- insert(GoalVars1, ReuseVar, GoalVars2)
+ insert(ReuseVar, GoalVars1, GoalVars2)
;
MaybeReuseVar = no,
GoalVars2 = GoalVars1
),
(
MaybeSizeVar = yes(SizeVar),
- insert(GoalVars2, SizeVar, GoalVars3)
+ insert(SizeVar, GoalVars2, GoalVars3)
;
MaybeSizeVar = no,
GoalVars3 = GoalVars2
),
(
MaybeRegionVar = yes(RegionVar),
- insert(GoalVars3, RegionVar, GoalVars)
+ insert(RegionVar, GoalVars3, GoalVars)
;
MaybeRegionVar = no,
GoalVars = GoalVars3
@@ -607,7 +607,7 @@
(
GoalType = unknown_atomic_goal_type,
Outer = atomic_interface_vars(OuterDI, OuterUO),
- insert_list(NonLocalVars0, [OuterDI, OuterUO], NonLocalVars)
+ insert_list([OuterDI, OuterUO], NonLocalVars0, NonLocalVars)
;
( GoalType = top_level_atomic_goal
; GoalType = nested_atomic_goal
@@ -694,7 +694,7 @@
implicitly_quantify_goal_quant_info(SubGoal1, SubGoal,
NonLocalsToRecompute, !Info),
get_nonlocals(!.Info, NonLocals0),
- delete_list(NonLocals0, Vars, NonLocals),
+ delete_list(Vars, NonLocals0, NonLocals),
set_nonlocals(NonLocals, !Info)
;
Reason0 = from_ground_term(TermVar, from_ground_term_construct),
@@ -734,7 +734,7 @@
implicitly_quantify_goal_quant_info(SubGoal1, SubGoal,
NonLocalsToRecompute, !Info),
get_nonlocals(!.Info, NonLocals0),
- delete_list(NonLocals0, Vars, NonLocals),
+ delete_list(Vars, NonLocals0, NonLocals),
set_nonlocals(NonLocals, !Info)
),
set_quant_vars(QuantVars, !Info),
@@ -756,7 +756,7 @@
!Info) :-
get_outside(!.Info, OutsideVars),
get_lambda_outside(!.Info, LambdaOutsideVars),
- get_quant_vars(!.Info, QuantVars),
+ get_quant_vars(!.Info, QuantVars0),
% Rename apart all the quantified variables that occur
% outside this goal.
QVars = list_to_set(Vars0),
@@ -794,8 +794,8 @@
)
),
update_seen_vars(QVars, !Info),
- insert_list(QuantVars, Vars, QuantVars1),
- set_quant_vars(QuantVars1, !Info).
+ insert_list(Vars, QuantVars0, QuantVars),
+ set_quant_vars(QuantVars, !Info).
:- pred implicitly_quantify_goal_quant_info_bi_implication(
hlds_goal, hlds_goal, hlds_goal_expr, hlds_goal_info,
@@ -974,7 +974,7 @@
set_quant_vars(QuantVars, !Info),
% Add the lambda vars as outside vars, since they are outside of the
% lambda goal.
- insert_list(OutsideVars1, LambdaVars, OutsideVars),
+ insert_list(LambdaVars, OutsideVars1, OutsideVars),
set_outside(OutsideVars, !Info),
% Set the LambdaOutsideVars set to empty, because variables that occur
% outside this lambda expression only in other lambda expressions
@@ -990,7 +990,7 @@
get_nonlocals(!.Info, NonLocals0),
% Lambda-quantified variables are local.
- delete_list(NonLocals0, LambdaVars, NonLocals),
+ delete_list(LambdaVars, NonLocals0, NonLocals),
set_quant_vars(QuantVars0, !Info),
set_outside(OutsideVars0, !Info),
set_lambda_outside(LambdaOutsideVars0, !Info),
@@ -1179,7 +1179,7 @@
% not inserted until the purity checking pass.
Inner0 = atomic_interface_vars(InnerDI, InnerUO),
get_outside(!.Info, OutsideVars0),
- insert_list(OutsideVars0, [InnerDI, InnerUO], OutsideVars),
+ insert_list([InnerDI, InnerUO], OutsideVars0, OutsideVars),
set_outside(OutsideVars, !Info)
),
implicitly_quantify_goal_quant_info(Goal0, Goal, NonLocalsToRecompute,
@@ -1788,15 +1788,15 @@
!Set, !LambdaSet) :-
(
GoalExpr = unify(LHS, RHS, _, Unification, _),
- insert(!.Set, LHS, !:Set),
+ insert(LHS, !Set),
(
Unification = construct(_, _, _, _, How, _, SubInfo),
(
How = reuse_cell(cell_to_reuse(ReuseVar, _, _)),
- insert(!.Set, ReuseVar, !:Set)
+ insert(ReuseVar, !Set)
;
How = construct_in_region(RegionVar),
- insert(!.Set, RegionVar, !:Set)
+ insert(RegionVar, !Set)
;
( How = construct_statically
; How = construct_dynamically
@@ -1806,13 +1806,13 @@
SubInfo = construct_sub_info(_, MaybeSize),
MaybeSize = yes(dynamic_size(SizeVar))
->
- insert(!.Set, SizeVar, !:Set)
+ insert(SizeVar, !Set)
;
true
)
;
Unification = complicated_unify(_, _, TypeInfoVars),
- insert_list(!.Set, TypeInfoVars, !:Set)
+ insert_list(TypeInfoVars, !Set)
;
( Unification = deconstruct(_, _, _, _, _, _)
; Unification = assign(_, _)
@@ -1823,18 +1823,18 @@
!Set, !LambdaSet)
;
GoalExpr = plain_call(_, _, ArgVars, _, _, _),
- insert_list(!.Set, ArgVars, !:Set)
+ insert_list(ArgVars, !Set)
;
GoalExpr = generic_call(GenericCall, ArgVars1, _, _),
goal_util.generic_call_vars(GenericCall, ArgVars0),
- insert_list(!.Set, ArgVars0, !:Set),
- insert_list(!.Set, ArgVars1, !:Set)
+ insert_list(ArgVars0, !Set),
+ insert_list(ArgVars1, !Set)
;
GoalExpr = call_foreign_proc(_, _, _, Args, ExtraArgs, _, _),
Vars = list.map(foreign_arg_var, Args),
ExtraVars = list.map(foreign_arg_var, ExtraArgs),
list.append(Vars, ExtraVars, AllVars),
- insert_list(!.Set, AllVars, !:Set)
+ insert_list(AllVars, !Set)
;
GoalExpr = conj(ConjType, Goals),
(
@@ -1848,7 +1848,7 @@
disj_vars_maybe_lambda(NonLocalsToRecompute, Goals, !Set, !LambdaSet)
;
GoalExpr = switch(Var, _Det, Cases),
- insert(!.Set, Var, !:Set),
+ insert(Var, !Set),
case_vars_maybe_lambda(NonLocalsToRecompute, Cases, !Set, !LambdaSet)
;
GoalExpr = if_then_else(Vars, Cond, Then, Else),
@@ -1863,8 +1863,8 @@
ElseSet, ElseLambdaSet),
union(CondSet, ThenSet, CondThenSet),
union(CondLambdaSet, ThenLambdaSet, CondThenLambdaSet),
- delete_list(CondThenSet, Vars, SomeCondThenSet),
- delete_list(CondThenLambdaSet, Vars, SomeCondThenLambdaSet),
+ delete_list(Vars, CondThenSet, SomeCondThenSet),
+ delete_list(Vars, CondThenLambdaSet, SomeCondThenLambdaSet),
union(!.Set, SomeCondThenSet, !:Set),
union(!.LambdaSet, SomeCondThenLambdaSet, !:LambdaSet),
union(!.Set, ElseSet, !:Set),
@@ -1891,24 +1891,24 @@
Reason = exist_quant(Vars),
goal_vars_both_maybe_lambda(NonLocalsToRecompute, SubGoal,
!:Set, !:LambdaSet),
- delete_list(!.Set, Vars, !:Set),
- delete_list(!.LambdaSet, Vars, !:LambdaSet)
+ delete_list(Vars, !Set),
+ delete_list(Vars, !LambdaSet)
;
Reason = promise_solutions(Vars, _Kind),
goal_vars_both_maybe_lambda(NonLocalsToRecompute, SubGoal,
!:Set, !:LambdaSet),
- insert_list(!.Set, Vars, !:Set)
+ insert_list(Vars, !Set)
;
Reason = require_complete_switch(Var),
goal_vars_both_maybe_lambda(NonLocalsToRecompute, SubGoal,
!:Set, !:LambdaSet),
- insert(!.Set, Var, !:Set)
+ insert(Var, !Set)
;
Reason = from_ground_term(TermVar, Kind),
(
Kind = from_ground_term_construct,
!:Set = init,
- insert(!.Set, TermVar, !:Set),
+ insert(TermVar, !Set),
!:LambdaSet = init
;
( Kind = from_ground_term_deconstruct
@@ -1933,7 +1933,7 @@
% XXX STM
Outer = atomic_interface_vars(OuterDI, OuterUO),
Inner = atomic_interface_vars(InnerDI, InnerUO),
- insert_list(!.Set, [OuterDI, OuterUO, InnerDI, InnerUO], !:Set),
+ insert_list([OuterDI, OuterUO, InnerDI, InnerUO], !Set),
disj_vars_maybe_lambda(NonLocalsToRecompute,
[MainGoal | OrElseGoals], !Set, !LambdaSet)
;
@@ -1957,15 +1957,15 @@
goal_expr_vars_maybe_lambda_and_bi_impl_2(GoalExpr, !Set, !LambdaSet) :-
(
GoalExpr = unify(LHS, RHS, _, Unification, _),
- insert(!.Set, LHS, !:Set),
+ insert(LHS, !Set),
(
Unification = construct(_, _, _, _, How, _, SubInfo),
(
How = reuse_cell(cell_to_reuse(ReuseVar, _, _)),
- insert(!.Set, ReuseVar, !:Set)
+ insert(ReuseVar, !Set)
;
How = construct_in_region(RegionVar),
- insert(!.Set, RegionVar, !:Set)
+ insert(RegionVar, !Set)
;
( How = construct_statically
; How = construct_dynamically
@@ -1975,13 +1975,13 @@
SubInfo = construct_sub_info(_, MaybeSize),
MaybeSize = yes(dynamic_size(SizeVar))
->
- insert(!.Set, SizeVar, !:Set)
+ insert(SizeVar, !Set)
;
true
)
;
Unification = complicated_unify(_, _, TypeInfoVars),
- insert_list(!.Set, TypeInfoVars, !:Set)
+ insert_list(TypeInfoVars, !Set)
;
( Unification = deconstruct(_, _, _, _, _, _)
; Unification = assign(_, _)
@@ -1991,18 +1991,18 @@
unify_rhs_vars_maybe_lambda_and_bi_impl(RHS, !Set, !LambdaSet)
;
GoalExpr = plain_call(_, _, ArgVars, _, _, _),
- insert_list(!.Set, ArgVars, !:Set)
+ insert_list(ArgVars, !Set)
;
GoalExpr = generic_call(GenericCall, ArgVars1, _, _),
goal_util.generic_call_vars(GenericCall, ArgVars0),
- insert_list(!.Set, ArgVars0, !:Set),
- insert_list(!.Set, ArgVars1, !:Set)
+ insert_list(ArgVars0, !Set),
+ insert_list(ArgVars1, !Set)
;
GoalExpr = call_foreign_proc(_, _, _, Args, ExtraArgs, _, _),
Vars = list.map(foreign_arg_var, Args),
ExtraVars = list.map(foreign_arg_var, ExtraArgs),
list.append(Vars, ExtraVars, AllVars),
- insert_list(!.Set, AllVars, !:Set)
+ insert_list(AllVars, !Set)
;
GoalExpr = conj(ConjType, Goals),
(
@@ -2016,7 +2016,7 @@
disj_vars_maybe_lambda_and_bi_impl(Goals, !Set, !LambdaSet)
;
GoalExpr = switch(Var, _Det, Cases),
- insert(!.Set, Var, !:Set),
+ insert(Var, !Set),
case_vars_maybe_lambda_and_bi_impl(Cases, !Set, !LambdaSet)
;
GoalExpr = if_then_else(Vars, Cond, Then, Else),
@@ -2031,8 +2031,8 @@
ElseSet, ElseLambdaSet),
union(CondSet, ThenSet, CondThenSet),
union(CondLambdaSet, ThenLambdaSet, CondThenLambdaSet),
- delete_list(CondThenSet, Vars, SomeCondThenSet),
- delete_list(CondThenLambdaSet, Vars, SomeCondThenLambdaSet),
+ delete_list(Vars, CondThenSet, SomeCondThenSet),
+ delete_list(Vars, CondThenLambdaSet, SomeCondThenLambdaSet),
union(!.Set, SomeCondThenSet, !:Set),
union(!.LambdaSet, SomeCondThenLambdaSet, !:LambdaSet),
union(!.Set, ElseSet, !:Set),
@@ -2059,18 +2059,18 @@
Reason = exist_quant(Vars),
goal_vars_both_maybe_lambda_and_bi_impl(SubGoal,
!:Set, !:LambdaSet),
- delete_list(!.Set, Vars, !:Set),
- delete_list(!.LambdaSet, Vars, !:LambdaSet)
+ delete_list(Vars, !Set),
+ delete_list(Vars, !LambdaSet)
;
Reason = promise_solutions(Vars, _Kind),
goal_vars_both_maybe_lambda_and_bi_impl(SubGoal,
!:Set, !:LambdaSet),
- insert_list(!.Set, Vars, !:Set)
+ insert_list(Vars, !Set)
;
Reason = require_complete_switch(Var),
goal_vars_both_maybe_lambda_and_bi_impl(SubGoal,
!:Set, !:LambdaSet),
- insert(!.Set, Var, !:Set)
+ insert(Var, !Set)
;
Reason = from_ground_term(_TermVar, _Kind),
goal_vars_both_maybe_lambda_and_bi_impl(SubGoal,
@@ -2088,7 +2088,7 @@
% XXX STM
Outer = atomic_interface_vars(OuterDI, OuterUO),
Inner = atomic_interface_vars(InnerDI, InnerUO),
- insert_list(!.Set, [OuterDI, OuterUO, InnerDI, InnerUO], !:Set),
+ insert_list([OuterDI, OuterUO, InnerDI, InnerUO], !Set),
disj_vars_maybe_lambda_and_bi_impl([MainGoal | OrElseGoals],
!Set, !LambdaSet)
;
@@ -2113,17 +2113,17 @@
goal_expr_vars_no_lambda_2(NonLocalsToRecompute, GoalExpr, !Set) :-
(
GoalExpr = unify(LHS, RHS, _, Unification, _),
- insert(!.Set, LHS, !:Set),
+ insert(LHS, !Set),
(
Unification = construct(_, _, _, _, How, _, SubInfo),
(
How = reuse_cell(cell_to_reuse(ReuseVar, _, SetArgs)),
MaybeSetArgs = yes(SetArgs),
- insert(!.Set, ReuseVar, !:Set)
+ insert(ReuseVar, !Set)
;
How = construct_in_region(RegionVar),
MaybeSetArgs = no,
- insert(!.Set, RegionVar, !:Set)
+ insert(RegionVar, !Set)
;
( How = construct_statically
; How = construct_dynamically
@@ -2134,14 +2134,14 @@
SubInfo = construct_sub_info(_, MaybeSize),
MaybeSize = yes(dynamic_size(SizeVar))
->
- insert(!.Set, SizeVar, !:Set)
+ insert(SizeVar, !Set)
;
true
)
;
Unification = complicated_unify(_, _, TypeInfoVars),
MaybeSetArgs = no,
- insert_list(!.Set, TypeInfoVars, !:Set)
+ insert_list(TypeInfoVars, !Set)
;
( Unification = deconstruct(_, _, _, _, _, _)
; Unification = assign(_, _)
@@ -2152,18 +2152,18 @@
unify_rhs_vars_no_lambda(NonLocalsToRecompute, RHS, MaybeSetArgs, !Set)
;
GoalExpr = plain_call(_, _, ArgVars, _, _, _),
- insert_list(!.Set, ArgVars, !:Set)
+ insert_list(ArgVars, !Set)
;
GoalExpr = generic_call(GenericCall, ArgVars1, _, _),
goal_util.generic_call_vars(GenericCall, ArgVars0),
- insert_list(!.Set, ArgVars0, !:Set),
- insert_list(!.Set, ArgVars1, !:Set)
+ insert_list(ArgVars0, !Set),
+ insert_list(ArgVars1, !Set)
;
GoalExpr = call_foreign_proc(_, _, _, Args, ExtraArgs, _, _),
Vars = list.map(foreign_arg_var, Args),
ExtraVars = list.map(foreign_arg_var, ExtraArgs),
list.append(Vars, ExtraVars, AllVars),
- insert_list(!.Set, AllVars, !:Set)
+ insert_list(AllVars, !Set)
;
GoalExpr = conj(ConjType, Goals),
(
@@ -2177,7 +2177,7 @@
disj_vars_no_lambda(NonLocalsToRecompute, Goals, !Set)
;
GoalExpr = switch(Var, _Det, Cases),
- insert(!.Set, Var, !:Set),
+ insert(Var, !Set),
case_vars_no_lambda(NonLocalsToRecompute, Cases, !Set)
;
GoalExpr = if_then_else(Vars, Cond, Then, Else),
@@ -2188,7 +2188,7 @@
goal_vars_both_no_lambda(NonLocalsToRecompute, Then, ThenSet),
goal_vars_both_no_lambda(NonLocalsToRecompute, Else, ElseSet),
union(CondSet, ThenSet, CondThenSet),
- delete_list(CondThenSet, Vars, SomeCondThenSet),
+ delete_list(Vars, CondThenSet, SomeCondThenSet),
union(!.Set, SomeCondThenSet, !:Set),
union(!.Set, ElseSet, !:Set)
;
@@ -2209,15 +2209,15 @@
;
Reason = exist_quant(Vars),
goal_vars_both_no_lambda(NonLocalsToRecompute, SubGoal, !:Set),
- delete_list(!.Set, Vars, !:Set)
+ delete_list(Vars, !Set)
;
Reason = promise_solutions(Vars, _Kind),
goal_vars_both_no_lambda(NonLocalsToRecompute, SubGoal, !:Set),
- insert_list(!.Set, Vars, !:Set)
+ insert_list(Vars, !Set)
;
Reason = require_complete_switch(Var),
goal_vars_both_no_lambda(NonLocalsToRecompute, SubGoal, !:Set),
- insert(!.Set, Var, !:Set)
+ insert(Var, !Set)
;
Reason = from_ground_term(_TermVar, _),
goal_vars_both_no_lambda(NonLocalsToRecompute, SubGoal, !:Set)
@@ -2233,7 +2233,7 @@
% XXX STM
Outer = atomic_interface_vars(OuterDI, OuterUO),
Inner = atomic_interface_vars(InnerDI, InnerUO),
- insert_list(!.Set, [OuterDI, OuterUO, InnerDI, InnerUO], !:Set),
+ insert_list([OuterDI, OuterUO, InnerDI, InnerUO], !Set),
disj_vars_no_lambda(NonLocalsToRecompute, [MainGoal | OrElseGoals],
!Set)
;
@@ -2255,17 +2255,17 @@
unify_rhs_vars_maybe_lambda(NonLocalsToRecompute, RHS, !Set, !LambdaSet) :-
(
RHS = rhs_var(Y),
- insert(!.Set, Y, !:Set)
+ insert(Y, !Set)
;
RHS = rhs_functor(_, _, ArgVars),
- insert_list(!.Set, ArgVars, !:Set)
+ insert_list(ArgVars, !Set)
;
RHS = rhs_lambda_goal(_, _, _, _, _, LambdaVars, _, _, Goal),
% Note that the NonLocals list is not counted, since all the
% variables in that list must occur in the goal.
- goal_vars_bitset_maybe_lambda(NonLocalsToRecompute, Goal, GoalVars),
- delete_list(GoalVars, LambdaVars, GoalVars1),
- union(!.LambdaSet, GoalVars1, !:LambdaSet)
+ goal_vars_bitset_maybe_lambda(NonLocalsToRecompute, Goal, GoalVars0),
+ delete_list(LambdaVars, GoalVars0, GoalVars),
+ union(!.LambdaSet, GoalVars, !:LambdaSet)
).
:- pred unify_rhs_vars_maybe_lambda_and_bi_impl(unify_rhs,
@@ -2276,17 +2276,17 @@
unify_rhs_vars_maybe_lambda_and_bi_impl(RHS, !Set, !LambdaSet) :-
(
RHS = rhs_var(Y),
- insert(!.Set, Y, !:Set)
+ insert(Y, !Set)
;
RHS = rhs_functor(_, _, ArgVars),
- insert_list(!.Set, ArgVars, !:Set)
+ insert_list(ArgVars, !Set)
;
RHS = rhs_lambda_goal(_, _, _, _, _, LambdaVars, _, _, Goal),
% Note that the NonLocals list is not counted, since all the
% variables in that list must occur in the goal.
- goal_vars_bitset_maybe_lambda_and_bi_impl(Goal, GoalVars),
- delete_list(GoalVars, LambdaVars, GoalVars1),
- union(!.LambdaSet, GoalVars1, !:LambdaSet)
+ goal_vars_bitset_maybe_lambda_and_bi_impl(Goal, GoalVars0),
+ delete_list(LambdaVars, GoalVars0, GoalVars),
+ union(!.LambdaSet, GoalVars, !:LambdaSet)
).
:- pred unify_rhs_vars_no_lambda(nonlocals_to_recompute, unify_rhs,
@@ -2299,7 +2299,7 @@
unify_rhs_vars_no_lambda(NonLocalsToRecompute, RHS, MaybeSetArgs, !Set) :-
(
RHS = rhs_var(Y),
- insert(!.Set, Y, !:Set)
+ insert(Y, !Set)
;
RHS = rhs_functor(_, _, ArgVars),
(
@@ -2308,9 +2308,9 @@
->
% Ignore the fields taken from the reused cell.
get_updated_fields(SetArgs, ArgVars, ArgsToSet),
- insert_list(!.Set, ArgsToSet, !:Set)
+ insert_list(ArgsToSet, !Set)
;
- insert_list(!.Set, ArgVars, !:Set)
+ insert_list(ArgVars, !Set)
)
;
RHS = rhs_lambda_goal(_, _, _, _, _, _, _, _, _),
@@ -2322,7 +2322,7 @@
insert_set_fields(SetArgs, Args, !Set) :-
get_updated_fields(SetArgs, Args, ArgsToSet),
- insert_list(!.Set, ArgsToSet, !:Set).
+ insert_list(ArgsToSet, !Set).
:- pred get_updated_fields(list(needs_update)::in,
list(prog_var)::in, list(prog_var)::out) is det.
Index: library/tree_bitset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/tree_bitset.m,v
retrieving revision 1.7
diff -u -r1.7 tree_bitset.m
--- library/tree_bitset.m 10 May 2011 05:26:52 -0000 1.7
+++ library/tree_bitset.m 19 May 2011 14:01:02 -0000
@@ -117,7 +117,7 @@
% only `X'. Takes O(log(card(Set))) time and space.
%
:- func insert(tree_bitset(T), T) = tree_bitset(T) <= enum(T).
-:- pred insert(tree_bitset(T)::in, T::in, tree_bitset(T)::out)
+:- pred insert(T::in, tree_bitset(T)::in, tree_bitset(T)::out)
is det <= enum(T).
% `insert_list(Set, X)' returns the union of `Set' and the set containing
@@ -125,14 +125,14 @@
% more efficient.
%
:- func insert_list(tree_bitset(T), list(T)) = tree_bitset(T) <= enum(T).
-:- pred insert_list(tree_bitset(T)::in, list(T)::in, tree_bitset(T)::out)
+:- pred insert_list(list(T)::in, tree_bitset(T)::in, tree_bitset(T)::out)
is det <= enum(T).
% `delete(Set, X)' returns the difference of `Set' and the set containing
% only `X'. Takes O(card(Set)) time and space.
%
:- func delete(tree_bitset(T), T) = tree_bitset(T) <= enum(T).
-:- pred delete(tree_bitset(T)::in, T::in, tree_bitset(T)::out)
+:- pred delete(T::in, tree_bitset(T)::in, tree_bitset(T)::out)
is det <= enum(T).
% `delete_list(Set, X)' returns the difference of `Set' and the set
@@ -140,22 +140,22 @@
% `difference(Set, list_to_set(X))', but may be more efficient.
%
:- func delete_list(tree_bitset(T), list(T)) = tree_bitset(T) <= enum(T).
-:- pred delete_list(tree_bitset(T)::in, list(T)::in, tree_bitset(T)::out)
+:- pred delete_list(list(T)::in, tree_bitset(T)::in, tree_bitset(T)::out)
is det <= enum(T).
- % `remove(Set0, X, Set)' returns in `Set' the difference of `Set0'
+ % `remove(X, Set0, Set)' returns in `Set' the difference of `Set0'
% and the set containing only `X', failing if `Set0' does not contain `X'.
% Takes O(log(card(Set))) time and space.
%
-:- pred remove(tree_bitset(T)::in, T::in, tree_bitset(T)::out)
+:- pred remove(T::in, tree_bitset(T)::in, tree_bitset(T)::out)
is semidet <= enum(T).
- % `remove_list(Set0, X, Set)' returns in `Set' the difference of `Set0'
+ % `remove_list(X, Set0, Set)' returns in `Set' the difference of `Set0'
% and the set containing all the elements of `X', failing if any element
% of `X' is not in `Set0'. Same as `subset(list_to_set(X), Set0),
% difference(Set0, list_to_set(X), Set)', but may be more efficient.
%
-:- pred remove_list(tree_bitset(T)::in, list(T)::in, tree_bitset(T)::out)
+:- pred remove_list(list(T)::in, tree_bitset(T)::in, tree_bitset(T)::out)
is semidet <= enum(T).
% `remove_leq(Set, X)' returns `Set' with all elements less than or equal
@@ -176,7 +176,7 @@
% `Set0', and `Set' is the set which contains all the elements of `Set0'
% except `X'. Takes O(1) time and space.
%
-:- pred remove_least(tree_bitset(T)::in, T::out, tree_bitset(T)::out)
+:- pred remove_least(T::out, tree_bitset(T)::in, tree_bitset(T)::out)
is semidet <= enum(T).
% `union(SetA, SetB)' returns the union of `SetA' and `SetB'. The
@@ -233,10 +233,14 @@
:- func foldl(func(T, U) = U, tree_bitset(T), U) = U <= enum(T).
:- pred foldl(pred(T, U, U), tree_bitset(T), U, U) <= enum(T).
-:- mode foldl(pred(in, di, uo) is det, in, di, uo) is det.
:- mode foldl(pred(in, in, out) is det, in, in, out) is det.
+:- mode foldl(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode foldl(pred(in, di, uo) is det, in, di, uo) is det.
:- mode foldl(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode foldl(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode foldl(pred(in, di, uo) is semidet, in, di, uo) is semidet.
:- mode foldl(pred(in, in, out) is nondet, in, in, out) is nondet.
+:- mode foldl(pred(in, mdi, muo) is nondet, in, mdi, muo) is nondet.
:- mode foldl(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
:- mode foldl(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
@@ -1027,14 +1031,14 @@
delete_list(Set, List) = difference(Set, list_to_set(List)).
-remove(Set0, Elem, Set) :-
- contains(Set0, Elem),
- Set = delete(Set0, Elem).
+remove(Elem, !Set) :-
+ contains(!.Set, Elem),
+ !:Set = delete(!.Set, Elem).
-remove_list(Set0, Elems, Set) :-
+remove_list(Elems, !Set) :-
ElemsSet = list_to_set(Elems),
- subset(ElemsSet, Set0),
- Set = difference(Set0, ElemsSet).
+ subset(ElemsSet, !.Set),
+ !:Set = difference(!.Set, ElemsSet).
%-----------------------------------------------------------------------------%
@@ -1196,7 +1200,7 @@
%-----------------------------------------------------------------------------%
-remove_least(Set0, Elem, Set) :-
+remove_least(Elem, Set0, Set) :-
Set0 = tree_bitset(List0),
(
List0 = leaf_list(LeafNodes0),
@@ -2639,13 +2643,17 @@
%-----------------------------------------------------------------------------%
-insert(A, B, insert(A, B)).
+insert(Elem, !Set) :-
+ !:Set = insert(!.Set, Elem).
-insert_list(A, B, insert_list(A, B)).
+insert_list(Elems, !Set) :-
+ !:Set = insert_list(!.Set, Elems).
-delete(A, B, delete(A, B)).
+delete(Elem, !Set) :-
+ !:Set = delete(!.Set, Elem).
-delete_list(A, B, delete_list(A, B)).
+delete_list(Elems, !Set) :-
+ !:Set = delete_list(!.Set, Elems).
union(A, B, union(A, B)).
@@ -2686,12 +2694,16 @@
).
:- pred do_foldl_pred(pred(T, U, U), list(interior_node), U, U) <= enum(T).
-:- mode do_foldl_pred(pred(in, di, uo) is det, in, di, uo) is det.
:- mode do_foldl_pred(pred(in, in, out) is det, in, in, out) is det.
+:- mode do_foldl_pred(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode do_foldl_pred(pred(in, di, uo) is det, in, di, uo) is det.
:- mode do_foldl_pred(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode do_foldl_pred(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode do_foldl_pred(pred(in, di, uo) is semidet, in, di, uo) is semidet.
:- mode do_foldl_pred(pred(in, in, out) is nondet, in, in, out) is nondet.
-:- mode do_foldl_pred(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
+:- mode do_foldl_pred(pred(in, mdi, muo) is nondet, in, mdi, muo) is nondet.
:- mode do_foldl_pred(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
+:- mode do_foldl_pred(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
:- pragma type_spec(do_foldl_pred/4, T = int).
:- pragma type_spec(do_foldl_pred/4, T = var(_)).
@@ -2709,12 +2721,16 @@
do_foldl_pred(P, T, !Acc).
:- pred leaf_foldl_pred(pred(T, U, U), list(leaf_node), U, U) <= enum(T).
-:- mode leaf_foldl_pred(pred(in, di, uo) is det, in, di, uo) is det.
:- mode leaf_foldl_pred(pred(in, in, out) is det, in, in, out) is det.
+:- mode leaf_foldl_pred(pred(in, mdi, muo) is det, in, mdi, muo) is det.
+:- mode leaf_foldl_pred(pred(in, di, uo) is det, in, di, uo) is det.
:- mode leaf_foldl_pred(pred(in, in, out) is semidet, in, in, out) is semidet.
+:- mode leaf_foldl_pred(pred(in, mdi, muo) is semidet, in, mdi, muo) is semidet.
+:- mode leaf_foldl_pred(pred(in, di, uo) is semidet, in, di, uo) is semidet.
:- mode leaf_foldl_pred(pred(in, in, out) is nondet, in, in, out) is nondet.
-:- mode leaf_foldl_pred(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
+:- mode leaf_foldl_pred(pred(in, mdi, muo) is nondet, in, mdi, muo) is nondet.
:- mode leaf_foldl_pred(pred(in, in, out) is cc_multi, in, in, out) is cc_multi.
+:- mode leaf_foldl_pred(pred(in, di, uo) is cc_multi, in, di, uo) is cc_multi.
:- pragma type_spec(leaf_foldl_pred/4, T = int).
:- pragma type_spec(leaf_foldl_pred/4, T = var(_)).
@@ -2933,16 +2949,24 @@
int, int, int, U, U) <= enum(T).
:- mode fold_bits(in, pred(in, in, out) is det,
in, in, in, in, out) is det.
+:- mode fold_bits(in, pred(in, mdi, muo) is det,
+ in, in, in, mdi, muo) is det.
:- mode fold_bits(in, pred(in, di, uo) is det,
in, in, in, di, uo) is det.
:- mode fold_bits(in, pred(in, in, out) is semidet,
in, in, in, in, out) is semidet.
+:- mode fold_bits(in, pred(in, mdi, muo) is semidet,
+ in, in, in, mdi, muo) is semidet.
+:- mode fold_bits(in, pred(in, di, uo) is semidet,
+ in, in, in, di, uo) is semidet.
:- mode fold_bits(in, pred(in, in, out) is nondet,
in, in, in, in, out) is nondet.
-:- mode fold_bits(in, pred(in, di, uo) is cc_multi,
- in, in, in, di, uo) is cc_multi.
+:- mode fold_bits(in, pred(in, mdi, muo) is nondet,
+ in, in, in, mdi, muo) is nondet.
:- mode fold_bits(in, pred(in, in, out) is cc_multi,
in, in, in, in, out) is cc_multi.
+:- mode fold_bits(in, pred(in, di, uo) is cc_multi,
+ in, in, in, di, uo) is cc_multi.
:- pragma type_spec(fold_bits/7, T = int).
:- pragma type_spec(fold_bits/7, T = var(_)).
--------------------------------------------------------------------------
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