[m-rev.] diff: deprecate procedures that use the "_det" suffix
Julien Fischer
juliensf at csse.unimelb.edu.au
Tue May 10 02:23:43 AEST 2011
Branches: main
Mark procedures whose names use the suffix "_det" to indicate that the procedure
is a det version of a semidet procedure of the same name (modulo the suffix) as
obsolete. The versions that use "det_" as a prefix should be used instead.
(The latter naming scheme is the one in general use throughout the standard
library.)
library/dir.m:
library/list.m:
library/stack.m:
As above.
Add versions with the "det_" suffix where they were not already
present.
Group function definitions together with the corresponding
predicate definition.
library/cord.m:
library/erlang_rtti_implementation.m:
library/io.m:
library/string.m:
compiler/*.m:
browser/declarative_execution.m:
browser/declarative_tree.m:
ssdb/ssdb.m:
Conform to the above changes.
library/Mercury.options:
Delete a setting for a deleted module.
NEWS:
Announce this change.
Julien.
Index: NEWS
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/NEWS,v
retrieving revision 1.566
diff -u -r1.566 NEWS
--- NEWS 8 May 2011 16:02:21 -0000 1.566
+++ NEWS 9 May 2011 15:56:27 -0000
@@ -95,6 +95,15 @@
version_hash_table.unsafe_new_default/1
version_store.new/1
+* The following procedures are have been deprecated and will be removed in
+ a future release: dir.basename_det/1, list.replace_nth_det/3,
+ list.replace_nth_det/4, list.index0_det/2, list.index1_det/2,
+ list.index0_det/2, list.index1_det/2, list.last_det/1, stack.top_det/1,
+ stack.pop_det/3.
+
+ The versions of these procedure that use "det_" as a prefix should be
+ used instead. (We have added these where they did not already exist.)
+
NEWS for Mercury 11.01
----------------------
Index: browser/declarative_execution.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_execution.m,v
retrieving revision 1.69
diff -u -r1.69 declarative_execution.m
--- browser/declarative_execution.m 8 May 2011 16:02:21 -0000 1.69
+++ browser/declarative_execution.m 9 May 2011 15:35:51 -0000
@@ -1517,7 +1517,7 @@
Which = all_headvars
),
maybe_filter_headvars(Which, Args0, Args),
- list.index1_det(Args, N, Arg).
+ list.det_index1(Args, N, Arg).
absolute_arg_num(any_head_var(ArgNum), _, ArgNum).
absolute_arg_num(user_head_var(N), atom(_, Args), ArgNum) :-
Index: browser/declarative_tree.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_tree.m,v
retrieving revision 1.65
diff -u -r1.65 declarative_tree.m
--- browser/declarative_tree.m 13 Jan 2011 00:36:51 -0000 1.65
+++ browser/declarative_tree.m 9 May 2011 15:36:17 -0000
@@ -882,7 +882,7 @@
exit_node_from_id(Store, Ref, ExitNode),
ExitAtom = get_trace_exit_atom(ExitNode),
ExitAtom = atom(_, Args),
- list.index1_det(Args, ArgNum, TryResultArgInfo),
+ list.det_index1(Args, ArgNum, TryResultArgInfo),
TryResultArgInfo = arg_info(_, _, yes(TryResultRep)),
rep_to_univ(TryResultRep, TryResultUniv),
univ_value(TryResultUniv) = TryResult,
@@ -1287,7 +1287,7 @@
DisjInitialPath = Path,
DisjLastStep = step_disj(N)
->
- list.index1_det(Disjs, N, Disj),
+ list.det_index1(Disjs, N, Disj),
DisjAndPath = goal_and_path(Disj, DisjPath),
MaybePrims = make_primitive_list(Store, [DisjAndPath | GoalPaths],
ContourTail, MaybeEnd, ArgNum, TotalArgs, HeadVars, AllTraced,
@@ -1307,7 +1307,7 @@
ArmInitialPath = Path,
ArmLastStep = step_switch(N, _)
->
- list.index1_det(Cases, N, Case),
+ list.det_index1(Cases, N, Case),
Case = case_rep(_ConsId, _ConsIdArity, Arm),
ArmAndPath = goal_and_path(Arm, ArmPath),
MaybePrims = make_primitive_list(Store, [ArmAndPath | GoalPaths],
@@ -1600,7 +1600,7 @@
Origin = origin_primitive_op(File, Line, primop_unification)
;
TermPath0 = [TermPathStep0 | TermPath],
- list.index1_det(FieldVars, TermPathStep0, Var),
+ list.det_index1(FieldVars, TermPathStep0, Var),
traverse_primitives(Prims, Var, TermPath, Store, ProcDefnRep,
Origin)
)
@@ -1627,7 +1627,7 @@
list.member(Var0, BoundVars),
TermPath0 = [TermPathStep0 | TermPath]
->
- list.index1_det(MaybeFieldVars, TermPathStep0, MaybeVar),
+ list.det_index1(MaybeFieldVars, TermPathStep0, MaybeVar),
(
MaybeVar = yes(Var),
% This partial deconstruction bound the TermPathStep0'th
@@ -1655,7 +1655,7 @@
Origin = origin_primitive_op(File, Line, primop_unification)
;
TermPath0 = [TermPathStep0 | TermPath],
- list.index1_det(MaybeFieldVars, TermPathStep0, MaybeVar),
+ list.det_index1(MaybeFieldVars, TermPathStep0, MaybeVar),
(
MaybeVar = yes(Var),
% The partial construction bound the TermPathStep0'th
@@ -1767,7 +1767,7 @@
Module = "builtin",
Name = "cc_multi_equal",
list.length(Args, 3),
- index1_det(Args, 2) = NewVar.
+ list.det_index1(Args, 2) = NewVar.
:- type plain_call_info
---> plain_call_info(
Index: compiler/check_typeclass.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/check_typeclass.m,v
retrieving revision 1.134
diff -u -r1.134 check_typeclass.m
--- compiler/check_typeclass.m 6 May 2011 05:03:19 -0000 1.134
+++ compiler/check_typeclass.m 9 May 2011 14:28:57 -0000
@@ -1756,7 +1756,7 @@
:- func induced_vars(list(mer_type), int, set(tvar)) = set(tvar).
induced_vars(Args, ArgNum, Vars) = union(Vars, NewVars) :-
- Arg = list.index1_det(Args, ArgNum),
+ Arg = list.det_index1(Args, ArgNum),
type_vars(Arg, ArgVars),
NewVars = set.list_to_set(ArgVars).
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.385
diff -u -r1.385 code_info.m
--- compiler/code_info.m 6 May 2011 05:03:19 -0000 1.385
+++ compiler/code_info.m 9 May 2011 14:31:52 -0000
@@ -1067,7 +1067,7 @@
current_resume_point_vars(CI) = ResumeVars :-
get_fail_info(CI, FailInfo),
FailInfo = fail_info(ResumePointStack, _, _, _, _),
- stack.top_det(ResumePointStack, ResumePointInfo),
+ stack.det_top(ResumePointStack, ResumePointInfo),
pick_first_resume_point(ResumePointInfo, ResumeMap, _),
map.keys(ResumeMap, ResumeMapVarList),
set.list_to_set(ResumeMapVarList, ResumeVars).
@@ -1767,7 +1767,7 @@
HijackInfo = disj_quarter_hijack,
expect(unify(CurfrMaxfr, must_be_equal), this_file,
"maxfr may differ from curfr in disj_quarter_hijack"),
- stack.top_det(ResumePoints, ResumePoint),
+ stack.det_top(ResumePoints, ResumePoint),
pick_stack_resume_point(ResumePoint, _, StackLabel),
LabelConst = const(llconst_code_addr(StackLabel)),
% peephole.m looks for the "curfr==maxfr" pattern in the comment.
@@ -1955,7 +1955,7 @@
ite_enter_then(HijackInfo, ITEResumePoint, ThenCode, ElseCode, !CI) :-
get_fail_info(!.CI, FailInfo0),
FailInfo0 = fail_info(ResumePoints0, ResumeKnown0, CurfrMaxfr, _, Allow),
- stack.pop_det(ResumePoints0, _, ResumePoints),
+ stack.det_pop(ResumePoints0, _, ResumePoints),
HijackInfo = ite_info(HijackResumeKnown, OldCondEnv, HijackType,
MaybeRegionInfo),
(
@@ -2012,7 +2012,7 @@
HijackType = ite_quarter_hijack,
expect(unify(MaybeRegionInfo, no), this_file,
"ite_enter_then: MaybeRegionInfo ite_quarter_hijack"),
- stack.top_det(ResumePoints, ResumePoint),
+ stack.det_top(ResumePoints, ResumePoint),
( maybe_pick_stack_resume_point(ResumePoint, _, StackLabel) ->
LabelConst = const(llconst_code_addr(StackLabel)),
ThenCode = singleton(
@@ -2209,7 +2209,7 @@
get_fail_info(!.CI, FailInfo0),
FailInfo0 = fail_info(ResumePoints0, ResumeKnown, CurfrMaxfr, CondEnv,
Allow),
- stack.top_det(ResumePoints0, TopResumePoint),
+ stack.det_top(ResumePoints0, TopResumePoint),
clone_resume_point(TopResumePoint, NewResumePoint, !CI),
stack.push(ResumePoints0, NewResumePoint, ResumePoints),
FailInfo = fail_info(ResumePoints, resume_point_known(has_been_done),
@@ -2358,7 +2358,7 @@
;
HijackInfo = commit_quarter_hijack,
FailInfo = fail_info(ResumePoints, _, _, _, _),
- stack.top_det(ResumePoints, TopResumePoint),
+ stack.det_top(ResumePoints, TopResumePoint),
pick_stack_resume_point(TopResumePoint, _, StackLabel),
StackLabelConst = const(llconst_code_addr(StackLabel)),
SuccessUndoCode = from_list([
@@ -2615,7 +2615,7 @@
get_fail_info(!.CI, FailInfo0),
FailInfo0 = fail_info(ResumePoints0, ResumeKnown, CurfrMaxfr,
CondEnv, Allow),
- stack.pop_det(ResumePoints0, _, ResumePoints),
+ stack.det_pop(ResumePoints0, _, ResumePoints),
FailInfo = fail_info(ResumePoints, ResumeKnown, CurfrMaxfr,
CondEnv, Allow),
set_fail_info(FailInfo, !CI).
@@ -2625,7 +2625,7 @@
top_resume_point(CI, ResumePoint) :-
get_fail_info(CI, FailInfo),
FailInfo = fail_info(ResumePoints, _, _, _, _),
- stack.top_det(ResumePoints, ResumePoint).
+ stack.det_top(ResumePoints, ResumePoint).
set_resume_point_to_unknown(!CI) :-
get_fail_info(!.CI, FailInfo0),
@@ -2648,7 +2648,7 @@
FailInfo = fail_info(ResumePoints, ResumeKnown, _, _, _),
(
ResumeKnown = resume_point_known(_),
- stack.top_det(ResumePoints, TopResumePoint),
+ stack.det_top(ResumePoints, TopResumePoint),
( pick_matching_resume_addr(!.CI, TopResumePoint, FailureAddress0) ->
FailureAddress = FailureAddress0,
PlaceCode = empty
@@ -2671,7 +2671,7 @@
FailInfo = fail_info(ResumePoints, ResumeKnown, _, _, _),
(
ResumeKnown = resume_point_known(_),
- stack.top_det(ResumePoints, TopResumePoint),
+ stack.det_top(ResumePoints, TopResumePoint),
( pick_matching_resume_addr(!.CI, TopResumePoint, FailureAddress0) ->
% We branch away if the test *fails*
code_util.neg_rval(Rval0, Rval),
@@ -2853,7 +2853,7 @@
compute_resume_var_stack_locs(CI, VarLocs) :-
get_fail_info(CI, FailInfo),
FailInfo = fail_info(ResumePointStack, _, _, _, _),
- stack.top_det(ResumePointStack, ResumePoint),
+ stack.det_top(ResumePointStack, ResumePoint),
pick_stack_resume_point(ResumePoint, StackMap, _),
map.to_assoc_list(StackMap, VarLocSets),
pick_var_places(VarLocSets, VarLocs).
Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.168
diff -u -r1.168 compile_target_code.m
--- compiler/compile_target_code.m 7 Mar 2011 01:13:45 -0000 1.168
+++ compiler/compile_target_code.m 9 May 2011 14:20:35 -0000
@@ -1345,7 +1345,7 @@
TargetType = executable,
list.map(
(pred(ModuleStr::in, ModuleName::out) is det :-
- file_name_to_module_name(dir.basename_det(ModuleStr),
+ file_name_to_module_name(dir.det_basename(ModuleStr),
ModuleName)
), Modules, ModuleNames),
MustCompile = yes,
@@ -2907,7 +2907,7 @@
join_module_list(_Globals, [], _Extension, [], !IO).
join_module_list(Globals, [Module | Modules], Extension,
[FileName | FileNames], !IO) :-
- file_name_to_module_name(dir.basename_det(Module), ModuleName),
+ file_name_to_module_name(dir.det_basename(Module), ModuleName),
module_name_to_file_name(Globals, ModuleName, Extension,
do_not_create_dirs, FileName, !IO),
join_module_list(Globals, Modules, Extension, FileNames, !IO).
Index: compiler/deforest.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/deforest.m,v
retrieving revision 1.100
diff -u -r1.100 deforest.m
--- compiler/deforest.m 6 May 2011 05:03:19 -0000 1.100
+++ compiler/deforest.m 9 May 2011 15:45:47 -0000
@@ -1896,7 +1896,7 @@
map.search(ProcArgInfos, proc(PredId, ProcId), ProcArgInfo),
ProcArgInfo = pd_branch_info(_, LeftArgs, _),
set.member(LeftArg, LeftArgs),
- list.index1_det(Args, LeftArg, Arg),
+ list.det_index1(Args, LeftArg, Arg),
instmap_lookup_var(InstMap, Arg, ArgInst),
inst_is_bound_to_functors(ModuleInfo, ArgInst, [_]),
Index: compiler/delay_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/delay_info.m,v
retrieving revision 1.34
diff -u -r1.34 delay_info.m
--- compiler/delay_info.m 3 May 2011 04:34:53 -0000 1.34
+++ compiler/delay_info.m 9 May 2011 14:29:47 -0000
@@ -259,11 +259,11 @@
delay_info_check_invariant(DelayInfo0),
DelayInfo0 = delay_info(CurrentDepth0, DelayedGoalStack0,
WaitingGoalsTable0, PendingGoals, NextSeqNums0),
- stack.pop_det(DelayedGoalStack0, DelayedGoals, DelayedGoalStack),
+ stack.det_pop(DelayedGoalStack0, DelayedGoals, DelayedGoalStack),
map.keys(DelayedGoals, SeqNums),
remove_delayed_goals(SeqNums, DelayedGoals, CurrentDepth0,
WaitingGoalsTable0, WaitingGoalsTable),
- stack.pop_det(NextSeqNums0, _, NextSeqNums),
+ stack.det_pop(NextSeqNums0, _, NextSeqNums),
CurrentDepth = CurrentDepth0 - 1,
map.values(DelayedGoals, DelayedGoalsList),
DelayInfo = delay_info(CurrentDepth, DelayedGoalStack,
@@ -301,12 +301,12 @@
WaitingGoalsTable0, PendingGoals, NextSeqNums0),
% Get the next sequence number
- stack.pop_det(NextSeqNums0, SeqNum, NextSeqNums1),
+ stack.det_pop(NextSeqNums0, SeqNum, NextSeqNums1),
NextSeq = SeqNum + 1,
stack.push(NextSeqNums1, NextSeq, NextSeqNums),
% Store the goal in the delayed goal stack
- stack.pop_det(DelayedGoalStack0, DelayedGoals0, DelayedGoalStack1),
+ stack.det_pop(DelayedGoalStack0, DelayedGoals0, DelayedGoalStack1),
map.set(SeqNum, delayed_goal(Vars, Error, Goal),
DelayedGoals0, DelayedGoals),
stack.push(DelayedGoalStack1, DelayedGoals, DelayedGoalStack),
@@ -470,7 +470,7 @@
PendingGoals0 = [SeqNum | PendingGoals],
map.set(CurrentDepth, PendingGoals,
PendingGoalsTable0, PendingGoalsTable),
- stack.pop_det(DelayedGoalStack0, DelayedGoals0, DelayedGoalStack1),
+ stack.det_pop(DelayedGoalStack0, DelayedGoals0, DelayedGoalStack1),
map.lookup(DelayedGoals0, SeqNum, DelayedGoal),
DelayedGoal = delayed_goal(_Vars, _ErrorReason, Goal),
map.delete(SeqNum, DelayedGoals0, DelayedGoals),
Index: compiler/dep_par_conj.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dep_par_conj.m,v
retrieving revision 1.51
diff -u -r1.51 dep_par_conj.m
--- compiler/dep_par_conj.m 5 May 2011 06:39:34 -0000 1.51
+++ compiler/dep_par_conj.m 9 May 2011 15:45:58 -0000
@@ -2283,7 +2283,7 @@
InitialModuleInfo = SpecInfo ^ spec_initial_module,
module_info_proc_info(InitialModuleInfo, PredProcId, ProcInfo),
proc_info_get_headvars(ProcInfo, HeadVars),
- list.index1_det(HeadVars, ArgPos, Var),
+ list.det_index1(HeadVars, ArgPos, Var),
proc_info_get_goal(ProcInfo, Goal),
(
PushOp = push_wait,
Index: compiler/distance_granularity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/distance_granularity.m,v
retrieving revision 1.14
diff -u -r1.14 distance_granularity.m
--- compiler/distance_granularity.m 6 May 2011 05:03:19 -0000 1.14
+++ compiler/distance_granularity.m 9 May 2011 15:45:14 -0000
@@ -557,7 +557,7 @@
( !.IndexInConj > Length ->
true
;
- list.index1_det(Goals0, !.IndexInConj, Goal0),
+ list.det_index1(Goals0, !.IndexInConj, Goal0),
Goal0 = hlds_goal(GoalExpr0, GoalInfo0),
(
GoalExpr0 = plain_call(CalleePredId, CalleeProcId, CallArgs0,
@@ -596,7 +596,7 @@
create_conj(UnifyGoal, Goal, plain_conj, PlainConj),
% Replace the call by the newly created conjunction.
- list.replace_nth_det(Goals0, !.IndexInConj, PlainConj,
+ list.det_replace_nth(Goals0, !.IndexInConj, PlainConj,
Goals),
!:GoalExpr = conj(parallel_conj, Goals)
;
@@ -663,7 +663,7 @@
( !.IndexInConj > Length ->
true
;
- list.index1_det(Goals0, !.IndexInConj, Goal0),
+ list.det_index1(Goals0, !.IndexInConj, Goal0),
Goal0 = hlds_goal(GoalExpr0, GoalInfo0),
(
GoalExpr0 = plain_call(CalleePredId, CalleeProcId, CallArgs0,
@@ -711,7 +711,7 @@
Detism = detism_det,
Purity = purity_pure,
% Take the context of the first goal of the conjunction.
- list.index1_det(Goals0, 1, FirstGoal),
+ list.det_index1(Goals0, 1, FirstGoal),
FirstGoal = hlds_goal(_, FirstGoalInfo),
Context = goal_info_get_context(FirstGoalInfo),
goal_info_init(NonLocals, InstMapDeltaDecrement, Detism,
@@ -737,7 +737,7 @@
goal_info_set_instmap_delta(InstMapDelta, GoalInfo0,
GoalInfo),
Goal = hlds_goal(GoalExpr, GoalInfo),
- list.replace_nth_det(Goals0, !.IndexInConj, Goal, Goals1),
+ list.det_replace_nth(Goals0, !.IndexInConj, Goal, Goals1),
% Append the goals in the right order.
list.det_split_list(!.IndexInConj - 1, Goals1, StartGoals,
Index: compiler/dupelim.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dupelim.m,v
retrieving revision 1.99
diff -u -r1.99 dupelim.m
--- compiler/dupelim.m 6 May 2011 05:03:19 -0000 1.99
+++ compiler/dupelim.m 9 May 2011 15:44:16 -0000
@@ -556,7 +556,7 @@
% had no executable instructions. While most_specific_instrs
% can delete comments from its input instruction sequences,
% it cannot delete executable instructions.
- list.last_det(Instrs, LastInstr),
+ list.det_last(Instrs, LastInstr),
( LastInstr = llds_instr(goto(code_label(Label)), _) ->
MaybeFallThrough = yes(Label)
;
Index: compiler/global_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/global_data.m,v
retrieving revision 1.46
diff -u -r1.46 global_data.m
--- compiler/global_data.m 3 May 2011 04:34:54 -0000 1.46
+++ compiler/global_data.m 9 May 2011 15:46:24 -0000
@@ -411,7 +411,7 @@
map.lookup(CellGroupMap, TypeNum, CellGroup),
CellGroupMembers = CellGroup ^ scalar_cell_group_members,
bimap.reverse_lookup(CellGroupMembers, Rvals, DataId),
- list.index0_det(Rvals, Offset, Rval).
+ list.det_index0(Rvals, Offset, Rval).
%-----------------------------------------------------------------------------%
Index: compiler/goal_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/goal_util.m,v
retrieving revision 1.184
diff -u -r1.184 goal_util.m
--- compiler/goal_util.m 6 May 2011 05:03:20 -0000 1.184
+++ compiler/goal_util.m 9 May 2011 15:43:41 -0000
@@ -1891,7 +1891,7 @@
Conj0, MaybeConj),
(
MaybeConj = ok(Conj),
- list.replace_nth_det(Conjs0, ConjNum, Conj, Conjs),
+ list.det_replace_nth(Conjs0, ConjNum, Conj, Conjs),
GoalExpr = conj(ConjType, Conjs),
MaybeGoal = ok(Goal0 ^ hlds_goal_expr := GoalExpr)
;
@@ -1913,7 +1913,7 @@
Disj0, MaybeDisj),
(
MaybeDisj = ok(Disj),
- list.replace_nth_det(Disjs0, DisjNum, Disj, Disjs),
+ list.det_replace_nth(Disjs0, DisjNum, Disj, Disjs),
GoalExpr = disj(Disjs),
MaybeGoal = ok(Goal0 ^ hlds_goal_expr := GoalExpr)
;
@@ -1937,7 +1937,7 @@
(
MaybeCaseGoal = ok(CaseGoal),
Case = Case0 ^ case_goal := CaseGoal,
- list.replace_nth_det(Cases0, CaseNum, Case, Cases),
+ list.det_replace_nth(Cases0, CaseNum, Case, Cases),
GoalExpr = switch(Var, CanFail, Cases),
MaybeGoal = ok(Goal0 ^ hlds_goal_expr := GoalExpr)
;
@@ -2073,7 +2073,7 @@
LaterSteps, Instmap, Conj0, MaybeConj),
(
MaybeConj = ok(Conj),
- list.replace_nth_det(Conjs0, ConjNum, Conj, Conjs),
+ list.det_replace_nth(Conjs0, ConjNum, Conj, Conjs),
GoalExpr = conj(ConjType, Conjs),
MaybeGoal = ok(Goal0 ^ hlds_goal_expr := GoalExpr)
;
@@ -2095,7 +2095,7 @@
LaterSteps, Instmap0, Disj0, MaybeDisj),
(
MaybeDisj = ok(Disj),
- list.replace_nth_det(Disjs0, DisjNum, Disj, Disjs),
+ list.det_replace_nth(Disjs0, DisjNum, Disj, Disjs),
MaybeGoal = ok(Goal0 ^ hlds_goal_expr := disj(Disjs))
;
( MaybeDisj = error(_)
@@ -2118,7 +2118,7 @@
(
MaybeCaseGoal = ok(CaseGoal),
Case = Case0 ^ case_goal := CaseGoal,
- list.replace_nth_det(Cases0, CaseNum, Case, Cases),
+ list.det_replace_nth(Cases0, CaseNum, Case, Cases),
GoalExpr = switch(Var, CanFail, Cases),
MaybeGoal = ok(Goal0 ^ hlds_goal_expr := GoalExpr)
;
Index: compiler/higher_order.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.193
diff -u -r1.193 higher_order.m
--- compiler/higher_order.m 6 May 2011 05:03:20 -0000 1.193
+++ compiler/higher_order.m 9 May 2011 15:45:28 -0000
@@ -969,7 +969,7 @@
MaybeMethod = yes(Method),
module_info_get_instance_table(ModuleInfo, Instances),
map.lookup(Instances, ClassId, InstanceList),
- list.index1_det(InstanceList, Instance, InstanceDefn),
+ list.det_index1(InstanceList, Instance, InstanceDefn),
InstanceDefn = hlds_instance_defn(_, _, _,
InstanceConstraints, InstanceTypes0, _,
yes(ClassInterface), _, _),
@@ -981,7 +981,7 @@
list.take(NumArgsToExtract, OtherTypeClassArgs,
InstanceConstraintArgs)
->
- list.index1_det(ClassInterface, Method,
+ list.det_index1(ClassInterface, Method,
hlds_class_proc(PredId, ProcId)),
list.append(InstanceConstraintArgs, Args, AllArgs)
;
@@ -1067,7 +1067,7 @@
Constraints = Constraints0,
UnconstrainedTVarTypes = UnconstrainedTVarTypes0,
yes(ClassInterface) = Instance ^ instance_hlds_interface,
- list.index1_det(ClassInterface, MethodNum,
+ list.det_index1(ClassInterface, MethodNum,
hlds_class_proc(PredId, ProcId))
;
find_matching_instance_method(Instances, MethodNum, ClassTypes,
@@ -2017,7 +2017,7 @@
->
module_info_get_instance_table(ModuleInfo, Instances),
map.lookup(Instances, ClassId, InstanceDefns),
- list.index1_det(InstanceDefns, InstanceNum, InstanceDefn),
+ list.det_index1(InstanceDefns, InstanceNum, InstanceDefn),
InstanceDefn = hlds_instance_defn(_, _, _, Constraints, InstanceTypes,
_, _, _, _),
(
@@ -2037,7 +2037,7 @@
Manipulator = instance_constraint_from_typeclass_info,
Index = Index0
),
- list.index1_det(OtherVars, Index, TypeInfoArg),
+ list.det_index1(OtherVars, Index, TypeInfoArg),
maybe_add_alias(TypeInfoVar, TypeInfoArg, !Info),
Uni = assign(TypeInfoVar, TypeInfoArg),
Goal = unify(TypeInfoVar, rhs_var(TypeInfoArg), out_mode - in_mode,
@@ -3112,7 +3112,7 @@
HOArg = higher_order_arg(ConsId, Index, NumArgs, CurriedArgs,
CurriedArgTypes, CurriedArgRttiInfo, CurriedHOArgs, IsConst),
- list.index1_det(HeadVars0, Index, LVar),
+ list.det_index1(HeadVars0, Index, LVar),
( ConsId = closure_cons(ShroudedPredProcId, _) ->
% Add the curried arguments to the procedure's argument list.
proc(PredId, ProcId) =
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.262
diff -u -r1.262 intermod.m
--- compiler/intermod.m 6 May 2011 05:03:21 -0000 1.262
+++ compiler/intermod.m 9 May 2011 14:48:30 -0000
@@ -1607,7 +1607,7 @@
unmake_hlds_class_fundep_2(TVars, Set) = solutions.solutions(P) :-
P = (pred(TVar::out) is nondet :-
set.member(N, Set),
- TVar = list.index1_det(TVars, N)
+ TVar = list.det_index1(TVars, N)
).
:- pred write_instances(hlds_out_info::in,
Index: compiler/lco.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/lco.m,v
retrieving revision 1.68
diff -u -r1.68 lco.m
--- compiler/lco.m 5 May 2011 06:39:35 -0000 1.68
+++ compiler/lco.m 9 May 2011 15:47:51 -0000
@@ -1113,7 +1113,7 @@
bound_inst_with_free_arg(ConsId, FreeArg) = Inst :-
Arity = cons_id_arity(ConsId),
list.duplicate(Arity, ground_inst, ArgInsts0),
- list.replace_nth_det(ArgInsts0, FreeArg, free_inst, ArgInsts),
+ list.det_replace_nth(ArgInsts0, FreeArg, free_inst, ArgInsts),
Inst = bound_functor(ConsId, ArgInsts).
%-----------------------------------------------------------------------------%
Index: compiler/llds_to_x86_64.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_to_x86_64.m,v
retrieving revision 1.18
diff -u -r1.18 llds_to_x86_64.m
--- compiler/llds_to_x86_64.m 25 Mar 2011 03:13:40 -0000 1.18
+++ compiler/llds_to_x86_64.m 9 May 2011 15:47:08 -0000
@@ -920,7 +920,7 @@
:- pred get_last_instr_operand(list(x86_64_instr)::in, operand::out) is det.
get_last_instr_operand(Instrs, Op) :-
- list.last_det(Instrs, LastInstr),
+ list.det_last(Instrs, LastInstr),
(
LastInstr = x86_64_comment(Comment),
Op = operand_label(Comment)
Index: compiler/ml_gen_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_gen_info.m,v
retrieving revision 1.3
diff -u -r1.3 ml_gen_info.m
--- compiler/ml_gen_info.m 6 May 2011 05:03:22 -0000 1.3
+++ compiler/ml_gen_info.m 9 May 2011 14:32:26 -0000
@@ -578,12 +578,12 @@
ml_gen_info_pop_success_cont(!Info) :-
ml_gen_info_get_success_cont_stack(!.Info, Stack0),
- stack.pop_det(Stack0, _SuccCont, Stack),
+ stack.det_pop(Stack0, _SuccCont, Stack),
ml_gen_info_set_success_cont_stack(Stack, !Info).
ml_gen_info_current_success_cont(Info, SuccCont) :-
ml_gen_info_get_success_cont_stack(Info, Stack),
- stack.top_det(Stack, SuccCont).
+ stack.det_top(Stack, SuccCont).
ml_gen_info_set_var_lval(Var, Lval, !Info) :-
ml_gen_info_get_var_lvals(!.Info, VarLvals0),
Index: compiler/mode_constraint_robdd.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_constraint_robdd.m,v
retrieving revision 1.20
diff -u -r1.20 mode_constraint_robdd.m
--- compiler/mode_constraint_robdd.m 5 May 2011 03:58:55 -0000 1.20
+++ compiler/mode_constraint_robdd.m 9 May 2011 14:30:23 -0000
@@ -254,7 +254,7 @@
leave_lambda_goal(!MCI) :-
LambdaPath0 = !.MCI ^ mci_lambda_path,
- stack.pop_det(LambdaPath0, _GoalPath, LambdaPath),
+ stack.det_pop(LambdaPath0, _GoalPath, LambdaPath),
!MCI ^ mci_lambda_path := LambdaPath.
:- type prog_var_and_level
Index: compiler/mode_ordering.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_ordering.m,v
retrieving revision 1.35
diff -u -r1.35 mode_ordering.m
--- compiler/mode_ordering.m 27 Jan 2011 08:03:52 -0000 1.35
+++ compiler/mode_ordering.m 9 May 2011 14:30:37 -0000
@@ -172,7 +172,7 @@
leave_lambda_goal(!MOI) :-
LambdaNesting0 = !.MOI ^ moi_lambda_nesting,
- stack.pop_det(LambdaNesting0, _, LambdaNesting),
+ stack.det_pop(LambdaNesting0, _, LambdaNesting),
!MOI ^ moi_lambda_nesting := LambdaNesting.
:- pred mode_order_goal(hlds_goal::in, hlds_goal::out,
Index: compiler/ordering_mode_constraints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ordering_mode_constraints.m,v
retrieving revision 1.32
diff -u -r1.32 ordering_mode_constraints.m
--- compiler/ordering_mode_constraints.m 6 May 2011 05:03:22 -0000 1.32
+++ compiler/ordering_mode_constraints.m 9 May 2011 15:40:00 -0000
@@ -350,7 +350,7 @@
% Then solve the constraints and reorder.
minimum_reordering(OCInfo, Order),
- list.map(list.index1_det(Goals0), Order, Goals1),
+ list.map(list.det_index1(Goals0), Order, Goals1),
% Then recurse on the reordered goals.
list.map(
Index: compiler/pd_term.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pd_term.m,v
retrieving revision 1.21
diff -u -r1.21 pd_term.m
--- compiler/pd_term.m 3 May 2011 04:34:57 -0000 1.21
+++ compiler/pd_term.m 9 May 2011 16:19:06 -0000
@@ -290,7 +290,7 @@
OldTotal, NewTotal) :-
get_matching_sizes(ModuleInfo, InstMap, Args, OldSizes, NewSizes,
OldTotal1, NewTotal1),
- list.index1_det(Args, ArgNo, Arg),
+ list.det_index1(Args, ArgNo, Arg),
instmap_lookup_var(InstMap, Arg, ArgInst),
pd_util.inst_size(ModuleInfo, ArgInst, NewSize),
OldTotal = OldTotal1 + OldSize,
Index: compiler/pd_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pd_util.m,v
retrieving revision 1.81
diff -u -r1.81 pd_util.m
--- compiler/pd_util.m 6 May 2011 05:03:22 -0000 1.81
+++ compiler/pd_util.m 9 May 2011 15:47:28 -0000
@@ -401,11 +401,11 @@
convert_branch_info_2(ArgList, Args, BranchVarMap0, BranchVarMap),
set.to_sorted_list(LeftArgs, LeftArgNos),
- list.map(list.index1_det(Args), LeftArgNos, LeftVars0),
+ list.map(list.det_index1(Args), LeftArgNos, LeftVars0),
set.list_to_set(LeftVars0, LeftVars),
set.to_sorted_list(OpaqueArgs, OpaqueArgNos),
- list.map(list.index1_det(Args), OpaqueArgNos, OpaqueVars0),
+ list.map(list.det_index1(Args), OpaqueArgNos, OpaqueVars0),
set.list_to_set(OpaqueVars0, OpaqueVars),
VarInfo = pd_branch_info(BranchVarMap, LeftVars, OpaqueVars).
@@ -415,7 +415,7 @@
convert_branch_info_2([], _, !VarInfo).
convert_branch_info_2([ArgNo - Branches | ArgInfos], Args, !VarInfo) :-
- list.index1_det(Args, ArgNo, Arg),
+ list.det_index1(Args, ArgNo, Arg),
map.set(Arg, Branches, !VarInfo),
convert_branch_info_2(ArgInfos, Args, !VarInfo).
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.362
diff -u -r1.362 polymorphism.m
--- compiler/polymorphism.m 6 May 2011 05:03:23 -0000 1.362
+++ compiler/polymorphism.m 9 May 2011 15:40:24 -0000
@@ -2399,7 +2399,7 @@
module_info_get_instance_table(ModuleInfo, InstanceTable),
map.lookup(InstanceTable, ClassId, InstanceList),
- list.index1_det(InstanceList, InstanceNum, ProofInstanceDefn),
+ list.det_index1(InstanceList, InstanceNum, ProofInstanceDefn),
ProofInstanceDefn = hlds_instance_defn(_, _, _, InstanceConstraints,
InstanceTypes, _, _, InstanceTVarset, InstanceProofs),
@@ -2534,7 +2534,7 @@
Constraint = constraint(ClassName, ConstraintArgTypes),
ClassId = class_id(ClassName, list.length(ConstraintArgTypes)),
map.lookup(InstanceTable, ClassId, InstanceList),
- list.index1_det(InstanceList, InstanceNum, InstanceDefn),
+ list.det_index1(InstanceList, InstanceNum, InstanceDefn),
InstanceModuleName = InstanceDefn ^ instance_module,
make_instance_string(InstanceTypes, InstanceString),
ConsId = base_typeclass_info_const(InstanceModuleName, ClassId,
Index: compiler/post_typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/post_typecheck.m,v
retrieving revision 1.148
diff -u -r1.148 post_typecheck.m
--- compiler/post_typecheck.m 6 May 2011 05:03:23 -0000 1.148
+++ compiler/post_typecheck.m 9 May 2011 15:40:36 -0000
@@ -1300,7 +1300,7 @@
(
ExistQVars = [_ | _],
map.lookup(!.VarTypes, FieldVar, FieldType),
- list.index1_det(ArgTypes0, FieldNumber, FieldArgType),
+ list.det_index1(ArgTypes0, FieldNumber, FieldArgType),
( type_list_subsumes([FieldArgType], [FieldType], FieldSubst) ->
apply_rec_subst_to_type_list(FieldSubst, ArgTypes0, ArgTypes)
;
Index: compiler/push_goals_together.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/push_goals_together.m,v
retrieving revision 1.7
diff -u -r1.7 push_goals_together.m
--- compiler/push_goals_together.m 3 May 2011 04:34:57 -0000 1.7
+++ compiler/push_goals_together.m 9 May 2011 15:46:42 -0000
@@ -360,7 +360,7 @@
% For now, we don't allow that.
PushConjNum + 1 = Lo
->
- list.replace_nth_det(Before0, PushConjNum, PushIntoGoal, Before),
+ list.det_replace_nth(Before0, PushConjNum, PushIntoGoal, Before),
GoalExpr = conj(plain_conj, Before ++ After),
!:Goal = hlds_goal(GoalExpr, GoalInfo0),
Result = push_succeeded
@@ -668,7 +668,7 @@
->
push_into_goal(LoHi, LaterHeadSteps, LaterTailSteps,
SelectedConjunct0, SelectedConjunct, Pushable),
- list.replace_nth_det(Conjuncts0, ConjNum, SelectedConjunct,
+ list.det_replace_nth(Conjuncts0, ConjNum, SelectedConjunct,
Conjuncts),
GoalExpr = conj(ConjType, Conjuncts),
Goal = hlds_goal(GoalExpr, GoalInfo0)
Index: compiler/rtti.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/rtti.m,v
retrieving revision 1.96
diff -u -r1.96 rtti.m
--- compiler/rtti.m 30 Dec 2010 11:17:58 -0000 1.96
+++ compiler/rtti.m 9 May 2011 15:39:11 -0000
@@ -1686,7 +1686,7 @@
type_ctor_details_num_ptags(tcd_foreign_enum(_, _, _, _, _, _)) = -1.
type_ctor_details_num_ptags(tcd_du(_, _, PtagMap, _, _)) = LastPtag + 1 :-
map.keys(PtagMap, Ptags),
- list.last_det(Ptags, LastPtag).
+ list.det_last(Ptags, LastPtag).
type_ctor_details_num_ptags(tcd_reserved(_, _, _, PtagMap, _, _)) = NumPtags :-
map.keys(PtagMap, Ptags),
(
@@ -1694,7 +1694,7 @@
NumPtags = -1
;
Ptags = [_ | _],
- list.last_det(Ptags, LastPtag),
+ list.det_last(Ptags, LastPtag),
NumPtags = LastPtag + 1
).
type_ctor_details_num_ptags(tcd_notag(_, _)) = -1.
Index: compiler/source_file_map.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/source_file_map.m,v
retrieving revision 1.27
diff -u -r1.27 source_file_map.m
--- compiler/source_file_map.m 3 May 2011 04:34:58 -0000 1.27
+++ compiler/source_file_map.m 9 May 2011 14:34:03 -0000
@@ -223,7 +223,7 @@
;
PartialFileName = FileName
),
- file_name_to_module_name(dir.basename_det(PartialFileName),
+ file_name_to_module_name(dir.det_basename(PartialFileName),
DefaultModuleName),
(
% Only include a module in the mapping if the name doesn't match
Index: compiler/transform_llds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/transform_llds.m,v
retrieving revision 1.37
diff -u -r1.37 transform_llds.m
--- compiler/transform_llds.m 5 May 2011 07:11:51 -0000 1.37
+++ compiler/transform_llds.m 9 May 2011 15:49:17 -0000
@@ -51,9 +51,9 @@
%-----------------------------------------------------------------------------%
-transform_llds(Globals, CFile0, CFile) :-
- ModuleName = CFile0 ^ cfile_modulename,
- Modules0 = CFile0 ^ cfile_code,
+transform_llds(Globals, !CFile) :-
+ ModuleName = !.CFile ^ cfile_modulename,
+ Modules0 = !.CFile ^ cfile_code,
% Split up large computed gotos.
globals.lookup_int_option(Globals, max_jump_table_size, MaxSize),
( MaxSize = 0 ->
@@ -67,14 +67,14 @@
GC = gc_accurate,
Modules1 = [_ | _]
->
- list.last_det(Modules1, LastModule),
+ list.det_last(Modules1, LastModule),
LastModule = comp_gen_c_module(LastModuleName, _),
Modules = Modules1 ++
[gen_end_label_module(ModuleName, LastModuleName)]
;
Modules = Modules1
),
- CFile = CFile0 ^ cfile_code := Modules.
+ !CFile ^ cfile_code := Modules.
% For LLDS native GC, we need to add a dummy comp_gen_c_module at the end
% of the list. This dummy module contains only a single dummy procedure
Index: compiler/tupling.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/tupling.m,v
retrieving revision 1.60
diff -u -r1.60 tupling.m
--- compiler/tupling.m 6 May 2011 05:03:24 -0000 1.60
+++ compiler/tupling.m 9 May 2011 16:18:40 -0000
@@ -1878,7 +1878,7 @@
prog_vars::out, prog_vars::out) is det.
extract_tupled_args_from_list(ArgList, Indices, Selected, NotSelected) :-
- list.map(list.index1_det(ArgList), Indices, Selected),
+ list.map(list.det_index1(ArgList), Indices, Selected),
extract_tupled_args_from_list_2(ArgList, 1, Indices, NotSelected).
:- pred extract_tupled_args_from_list_2(prog_vars::in, int::in, list(int)::in,
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.457
diff -u -r1.457 typecheck.m
--- compiler/typecheck.m 5 May 2011 07:11:51 -0000 1.457
+++ compiler/typecheck.m 9 May 2011 15:41:47 -0000
@@ -2823,7 +2823,7 @@
unexpected(this_file, "convert_field_access_cons_type_info: not type")
),
FieldDefn = hlds_ctor_field_defn(_, _, _, _, FieldNumber),
- list.index1_det(ConsArgTypes, FieldNumber, FieldType),
+ list.det_index1(ConsArgTypes, FieldNumber, FieldType),
(
AccessType = get,
Source = source_get_field_access(SourceType),
@@ -2878,7 +2878,7 @@
% requires that the fields are of the same type. It probably won't
% come up too often.
%
- list.replace_nth_det(ConsArgTypes, FieldNumber, int_type,
+ list.det_replace_nth(ConsArgTypes, FieldNumber, int_type,
ArgTypesWithoutField),
type_vars_list(ArgTypesWithoutField, TVarsInOtherArgs),
set.intersect(
Index: compiler/typecheck_errors.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck_errors.m,v
retrieving revision 1.50
diff -u -r1.50 typecheck_errors.m
--- compiler/typecheck_errors.m 1 Apr 2011 08:43:44 -0000 1.50
+++ compiler/typecheck_errors.m 9 May 2011 15:42:13 -0000
@@ -1918,7 +1918,7 @@
% the correct type?
VarType = defined_type(unqualified("<any>"), [], kind_star)
),
- list.index0_det(ArgTypes, 0, ArgType),
+ list.det_index0(ArgTypes, 0, ArgType),
apply_rec_subst_to_type(TypeBindings, ArgType, ArgType2),
apply_rec_subst_to_type(TypeBindings, VarType, VarType2),
ArgTypeStuff = arg_type_stuff(ArgType2, VarType2, TVarSet, HeadTypeParams),
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.168
diff -u -r1.168 unused_args.m
--- compiler/unused_args.m 6 May 2011 05:03:25 -0000 1.168
+++ compiler/unused_args.m 9 May 2011 16:18:55 -0000
@@ -434,7 +434,7 @@
(
UnusedArgs = [_ | _],
proc_info_get_headvars(ProcInfo, HeadVars),
- list.map(list.index1_det(HeadVars), UnusedArgs,
+ list.map(list.det_index1(HeadVars), UnusedArgs,
UnusedVars),
initialise_vardep(UnusedVars, !.VarDep, VarDep),
PredProcId = proc(PredId, ProcId),
Index: library/Mercury.options
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/Mercury.options,v
retrieving revision 1.36
diff -u -r1.36 Mercury.options
--- library/Mercury.options 27 Jan 2011 08:03:54 -0000 1.36
+++ library/Mercury.options 9 May 2011 12:56:52 -0000
@@ -39,11 +39,6 @@
# not being implemented for Java, which is a lie.
MCFLAGS-io += --no-halt-at-warn
-# Ignore warnings about obsolete procedures from this module since
-# the entire module is obsolete.
-#
-MCFLAGS-bintree_set += --no-warn-obsolete
-
# io.m uses library features that are supported by POSIX but which are not
# part of ANSI C, such as `struct stat', fileno(), and putenv().
# We need to pass --no-ansi to mgnuc to ensure that these are declared.
Index: library/cord.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/cord.m,v
retrieving revision 1.18
diff -u -r1.18 cord.m
--- library/cord.m 30 Dec 2010 11:18:04 -0000 1.18
+++ library/cord.m 9 May 2011 15:33:00 -0000
@@ -450,7 +450,7 @@
Last = Head
;
Tail = [_ | _],
- list.last_det(Tail, Last)
+ list.det_last(Tail, Last)
)
;
Node = branch_node(_, B),
Index: library/dir.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/dir.m,v
retrieving revision 1.58
diff -u -r1.58 dir.m
--- library/dir.m 9 Nov 2010 03:46:32 -0000 1.58
+++ library/dir.m 9 May 2011 12:58:01 -0000
@@ -94,11 +94,13 @@
% As above, but throws an exception instead of failing.
%
-:- func dir.basename_det(string) = string.
+:- func dir.det_basename(string) = string.
% A synonym for the above.
%
-:- func dir.det_basename(string) = string.
+:- pragma obsolete(dir.basename_det/1).
+:- func dir.basename_det(string) = string.
+
% dir.dirname(PathName) = DirName.
%
@@ -332,13 +334,13 @@
%-----------------------------------------------------------------------------%
-dir.det_basename(FileName) = dir.basename_det(FileName).
+dir.basename_det(FileName) = dir.det_basename(FileName).
-dir.basename_det(FileName) =
+dir.det_basename(FileName) =
( BaseName = dir.basename(FileName) ->
BaseName
;
- func_error("dir.basename_det: given directory is root directory")
+ func_error("dir.det_basename: given directory is root directory")
).
dir.basename(FileName) = BaseName :-
Index: library/erlang_rtti_implementation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/erlang_rtti_implementation.m,v
retrieving revision 1.30
diff -u -r1.30 erlang_rtti_implementation.m
--- library/erlang_rtti_implementation.m 20 Oct 2010 04:52:32 -0000 1.30
+++ library/erlang_rtti_implementation.m 9 May 2011 13:06:34 -0000
@@ -1039,7 +1039,7 @@
:- func get_du_functor_arg(type_info, erlang_du_functor, T, int) = univ.
get_du_functor_arg(TypeInfo, Functor, Term, Loc) = Univ :-
- ArgInfo = list.index1_det(Functor ^ edu_arg_infos, Loc),
+ ArgInfo = list.det_index1(Functor ^ edu_arg_infos, Loc),
MaybePTI = ArgInfo ^ du_arg_type,
Info = yes({TypeInfo, yes({Functor, Term})}),
@@ -2216,7 +2216,7 @@
(
MaybeExist = yes(ExistInfo),
% The first existential type variable is numbered 512.
- ExistLocn = list.index1_det(ExistInfo ^ exist_typeinfo_locns, N - 512),
+ ExistLocn = list.det_index1(ExistInfo ^ exist_typeinfo_locns, N - 512),
(
ExistLocn = plain_typeinfo(X),
Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.461
diff -u -r1.461 io.m
--- library/io.m 9 May 2011 06:08:52 -0000 1.461
+++ library/io.m 9 May 2011 15:33:37 -0000
@@ -5365,7 +5365,7 @@
io.progname_base(DefaultName, PrognameBase, !IO) :-
io.progname(DefaultName, Progname, !IO),
- PrognameBase = dir.basename_det(Progname).
+ PrognameBase = dir.det_basename(Progname).
:- pragma foreign_proc("C",
io.get_stream_id(Stream::in) = (Id::out),
Index: library/list.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/list.m,v
retrieving revision 1.201
diff -u -r1.201 list.m
--- library/list.m 18 Jan 2011 18:16:13 -0000 1.201
+++ library/list.m 9 May 2011 15:30:08 -0000
@@ -327,17 +327,20 @@
:- pred list.replace_nth(list(T)::in, int::in, T::in, list(T)::out)
is semidet.
- % list.replace_nth_det(List0, N, R, List) is true iff List is List0
+ % list.det_replace_nth(List0, N, R, List) is true iff List is List0
% with Nth element replaced with R.
% Aborts if N < 1 or if length of List0 < N.
% (Position numbers start from 1.)
%
+:- pred list.det_replace_nth(list(T)::in, int::in, T::in, list(T)::out) is det.
+:- func list.det_replace_nth(list(T), int, T) = list(T).
+
+:- pragma obsolete(list.replace_nth_det/4).
:- pred list.replace_nth_det(list(T)::in, int::in, T::in, list(T)::out)
is det.
+:- pragma obsolete(list.replace_nth_det/3).
:- func list.replace_nth_det(list(T), int, T) = list(T).
-:- func list.det_replace_nth(list(T), int, T) = list(T).
-
% list.sort_and_remove_dups(List0, List):
%
% List is List0 sorted with the second and subsequent occurrence of
@@ -387,16 +390,23 @@
% These predicates select an element in a list from it's position.
% The `index0' preds consider the first element to be element
% number zero, whereas the `index1' preds consider the first element
- % to be element number one. The `_det' preds call error/1 if the index
+ % to be element number one. The `det_' preds call error/1 if the index
% is out of range, whereas the semidet preds fail if the index is out of
% range.
%
:- pred list.index0(list(T)::in, int::in, T::out) is semidet.
:- pred list.index1(list(T)::in, int::in, T::out) is semidet.
+:- pred list.det_index0(list(T)::in, int::in, T::out) is det.
+:- pred list.det_index1(list(T)::in, int::in, T::out) is det.
+
+:- pragma obsolete(list.index0_det/3).
:- pred list.index0_det(list(T)::in, int::in, T::out) is det.
+:- pragma obsolete(list.index1_det/3).
:- pred list.index1_det(list(T)::in, int::in, T::out) is det.
+:- pragma obsolete(list.index0_det/2).
:- func list.index0_det(list(T), int) = T.
+:- pragma obsolete(list.index1_det/2).
:- func list.index1_det(list(T), int) = T.
:- func list.det_index0(list(T), int) = T.
:- func list.det_index1(list(T), int) = T.
@@ -465,10 +475,12 @@
% A deterministic version of list.last, which aborts instead of
% failing if the input list is empty.
%
-:- pred list.last_det(list(T)::in, T::out) is det.
:- pred list.det_last(list(T)::in, T::out) is det.
:- func list.det_last(list(T)) = T.
+:- pragma obsolete(list.last_det/2).
+:- pred list.last_det(list(T)::in, T::out) is det.
+
% list.split_last(List, AllButLast, Last) is true if Last is the
% last element of List and AllButLast is the list of elements before it.
%
@@ -1666,6 +1678,9 @@
list.cons(H, T) = [H | T].
+list.append(Xs, Ys) = Zs :-
+ list.append(Xs, Ys, Zs).
+
list.append([], Ys, Ys).
list.append([X | Xs], Ys, [X | Zs]) :-
list.append(Xs, Ys, Zs).
@@ -1707,18 +1722,36 @@
list.index0(Xs, N - 1, Elem)
).
-list.index0_det(List, N, Elem) :-
+list.det_index0(Xs, N) = A :-
+ list.det_index0(Xs, N, A).
+
+list.det_index0(List, N, Elem) :-
( list.index0(List, N, Elem0) ->
Elem = Elem0
;
- error("list.index: index out of range")
+ error("list.det_index0: index out of range")
).
+list.index0_det(Xs, N) = A :-
+ list.index0_det(Xs, N, A).
+
+list.index0_det(List, N, Elem) :-
+ list.det_index0(List, N, Elem).
+
list.index1(List, N, Elem) :-
list.index0(List, N - 1, Elem).
+list.det_index1(Xs, N) = A :-
+ list.det_index1(Xs, N, A).
+
+list.det_index1(List, N, Elem) :-
+ list.det_index0(List, N - 1, Elem).
+
list.index1_det(List, N, Elem) :-
- list.index0_det(List, N - 1, Elem).
+ list.det_index1(List, N, Elem).
+
+list.index1_det(Xs, N) = A :-
+ list.det_index1(Xs, N, A).
%-----------------------------------------------------------------------------%
@@ -1752,6 +1785,9 @@
%-----------------------------------------------------------------------------%
+list.condense(Xss) = Ys :-
+ list.condense(Xss, Ys).
+
list.condense([], []).
list.condense([L | Ls], R) :-
list.condense(Ls, R1),
@@ -1782,6 +1818,9 @@
Zs = [X | Zs1]
).
+list.delete_all(Xs, A) = Ys :-
+ list.delete_all(Xs, A, Ys).
+
list.delete_all([], _, []).
list.delete_all([X | Xs], Y, Zs) :-
( X = Y ->
@@ -1791,6 +1830,9 @@
Zs = [X | Zs1]
).
+list.delete_elems(Xs, Ys) = Zs :-
+ list.delete_elems(Xs, Ys, Zs).
+
list.delete_elems(Xs, [], Xs).
list.delete_elems(Xs, [E | Es], Zs) :-
list.delete_all(Xs, E, Ys),
@@ -1810,6 +1852,9 @@
List = [X | L1]
).
+list.replace_all(Xs, A, B) = Ys :-
+ list.replace_all(Xs, A, B, Ys).
+
list.replace_all([], _, _, []).
list.replace_all([X | Xs], Y, Z, L) :-
( X = Y ->
@@ -1824,17 +1869,26 @@
P > 0,
list.replace_nth_2(Xs, P, R, L).
+list.replace_nth_det(Xs, N, A) = Ys :-
+ list.det_replace_nth(Xs, N, A, Ys).
+
list.replace_nth_det(Xs, P, R, L) :-
+ list.det_replace_nth(Xs, P, R, L).
+
+list.det_replace_nth(Xs, N, A) = Ys :-
+ list.det_replace_nth(Xs, N, A, Ys).
+
+list.det_replace_nth(Xs, P, R, L) :-
( P > 0 ->
( list.replace_nth_2(Xs, P, R, L0) ->
L = L0
;
- error("list.replace_nth_det: " ++
+ error("list.det_replace_nth: " ++
"Can't replace element whose index " ++
"position is past the end of the list")
)
;
- error("list.replace_nth_det: " ++
+ error("list.det_replace_nth: " ++
"Can't replace element whose index " ++
"position is less than 1.")
).
@@ -1869,6 +1923,9 @@
%-----------------------------------------------------------------------------%
+list.merge(Xs, Ys) = Zs :-
+ list.merge(Xs, Ys, Zs).
+
list.merge([], [], []).
list.merge([A | As], [], [A | As]).
list.merge([], [B | Bs], [B | Bs]).
@@ -1882,6 +1939,9 @@
Cs = [A | Cs0]
).
+list.merge_and_remove_dups(Xs, Ys) = Zs :-
+ list.merge_and_remove_dups(Xs, Ys, Zs).
+
list.merge_and_remove_dups([], [], []).
list.merge_and_remove_dups([A | As], [], [A | As]).
list.merge_and_remove_dups([], [B | Bs], [B | Bs]).
@@ -1907,6 +1967,9 @@
% list.length/1 in pure Mercury that works in both directions
% unless you make it semidet rather than det.
+list.length(Xs) = N :-
+ list.length(Xs, N).
+
list.length(L, N) :-
list.length_2(L, 0, N).
@@ -1920,6 +1983,9 @@
%-----------------------------------------------------------------------------%
+list.reverse(Xs) = Ys :-
+ list.reverse(Xs, Ys).
+
% reverse(A, B) <=> reverse(B, A).
:- pragma promise_equivalent_clauses(list.reverse/2).
@@ -1944,9 +2010,14 @@
%-----------------------------------------------------------------------------%
+list.sort(Xs) = Ys :-
+ list.sort(Xs, Ys).
+
list.sort(L0, L) :-
list.merge_sort(L0, L).
+list.sort_and_remove_dups(Xs) = Ys :-
+ list.sort_and_remove_dups(Xs, Ys).
list.sort_and_remove_dups(L0, L) :-
list.merge_sort_and_remove_dups_2(list.length(L0), L0, L).
@@ -2000,6 +2071,9 @@
%-----------------------------------------------------------------------------%
+list.remove_dups(Xs) = Ys :-
+ list.remove_dups(Xs, Ys).
+
list.remove_dups(Xs, Ys) :-
list.remove_dups_2(Xs, set_tree234.init, Ys).
@@ -2018,6 +2092,9 @@
%-----------------------------------------------------------------------------%
+list.remove_adjacent_dups(Xs) = Ys :-
+ list.remove_adjacent_dups(Xs, Ys).
+
list.remove_adjacent_dups([], []).
list.remove_adjacent_dups([X | Xs], L) :-
list.remove_adjacent_dups_2(Xs, X, L).
@@ -2036,6 +2113,9 @@
%-----------------------------------------------------------------------------%
+list.zip(Xs, Ys) = Zs :-
+ list.zip(Xs, Ys, Zs).
+
list.zip([], Bs, Bs).
list.zip([A | As], Bs, [A | Cs]) :-
list.zip2(As, Bs, Cs).
@@ -2089,6 +2169,9 @@
Bs = []
).
+list.take_upto(N, Xs) = Ys :-
+ list.take_upto(N, Xs, Ys).
+
list.take_upto(N, As, Bs) :-
( list.take(N, As, Bs0) ->
Bs = Bs0
@@ -2119,6 +2202,9 @@
%-----------------------------------------------------------------------------%
+list.duplicate(N, A) = Xs :-
+ list.duplicate(N, A, Xs).
+
list.duplicate(N, X, list.duplicate_2(N, X, [])).
:- func list.duplicate_2(int, T, list(T)) = list(T).
@@ -2132,6 +2218,9 @@
%-----------------------------------------------------------------------------%
+list.chunk(Xs, N) = Ys :-
+ list.chunk(Xs, N, Ys).
+
list.chunk(List, ChunkSize, ListOfSmallLists) :-
list.chunk_2(List, ChunkSize, [], ChunkSize, ListOfSmallLists).
@@ -2196,27 +2285,27 @@
list.last(T, Last)
).
-list.last_det([], _) :-
- error("list.last_det: empty list").
-list.last_det([H | T], Last) :-
- list.last_det_2(H, T, Last).
+list.det_last(List) = Last :-
+ list.det_last(List, Last).
+
+list.det_last([], _) :-
+ error("list.det_last: empty list").
+list.det_last([H | T], Last) :-
+ list.det_last_2(H, T, Last).
-:- pred list.last_det_2(T::in, list(T)::in, T::out) is det.
+:- pred list.det_last_2(T::in, list(T)::in, T::out) is det.
-list.last_det_2(H, T, Last) :-
+list.det_last_2(H, T, Last) :-
(
T = [],
Last = H
;
T = [TH | TT],
- list.last_det_2(TH, TT, Last)
+ list.det_last_2(TH, TT, Last)
).
-list.det_last(List, Last) :-
- list.last_det(List, Last).
-
-list.det_last(List) = Last :-
- list.last_det(List, Last).
+list.last_det(List, Last) :-
+ list.det_last(List, Last).
list.split_last([H | T], AllButLast, Last) :-
(
@@ -2260,6 +2349,9 @@
%-----------------------------------------------------------------------------%
+list.map(_F, []) = [].
+list.map(F, [H | T]) = [F(H) | list.map(F, T)].
+
list.map(_, [], []).
list.map(P, [H0 | T0], [H | T]) :-
P(H0, H),
@@ -2421,6 +2513,10 @@
P(A, B, C, D, !Acc),
list.map_corresponding3_foldl(P, As, Bs, Cs, Ds, !Acc).
+list.foldl(F, Xs, A) = B :-
+ P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
+ list.foldl(P, Xs, A, B).
+
list.foldl(_, [], !A).
list.foldl(P, [H | T], !A) :-
P(H, !A),
@@ -2623,6 +2719,10 @@
list.filter_map_foldl(P, Xs, True, !A)
).
+list.foldr(F, Xs, A) = B :-
+ P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
+ list.foldr(P, Xs, A, B).
+
list.foldr(_, [], !A).
list.foldr(P, [H | T], !A) :-
list.foldr(P, T, !A),
@@ -2645,6 +2745,9 @@
list.find_first_match(P, T, FirstMatch)
).
+list.filter(P, Xs) = Trues :-
+ list.filter(P, Xs, Trues).
+
list.filter(_, [], []).
list.filter(P, [H | T], True) :-
( P(H) ->
@@ -2654,6 +2757,9 @@
list.filter(P, T, True)
).
+list.negated_filter(P, Xs) = Falses :-
+ list.negated_filter(P, Xs, Falses).
+
list.negated_filter(_, [], []).
list.negated_filter(P, [H | T], False) :-
( P(H) ->
@@ -2673,6 +2779,10 @@
False = [H | FalseTail]
).
+list.filter_map(F, Xs) = Ys :-
+ P = ( pred(X::in, Y::out) is semidet :- Y = F(X) ),
+ list.filter_map(P, Xs, Ys).
+
list.filter_map(_, [], []).
list.filter_map(P, [H0 | T0], True) :-
( P(H0, H) ->
@@ -2755,6 +2865,10 @@
L = [X0 | L0]
).
+list.sort(F, Xs) = Ys :-
+ P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
+ list.sort(P, Xs, Ys).
+
list.sort(P, L0, L) :-
list.length(L0, N),
( N = 0 ->
@@ -2803,6 +2917,10 @@
list.merge(P, L1, L2, L)
).
+list.merge(F, Xs, Ys) = Zs :-
+ P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
+ list.merge(P, Xs, Ys, Zs).
+
list.merge(_P, [], [], []).
list.merge(_P, [], [Y | Ys], [Y | Ys]).
list.merge(_P, [X | Xs], [], [X | Xs]).
@@ -2815,6 +2933,10 @@
L = [H1 | T]
).
+list.merge_and_remove_dups(F, Xs, Ys) = Zs :-
+ P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
+ list.merge_and_remove_dups(P, Xs, Ys, Zs).
+
list.merge_and_remove_dups(_P, [], [], []).
list.merge_and_remove_dups(_P, [], [Y | Ys], [Y | Ys]).
list.merge_and_remove_dups(_P, [X | Xs], [], [X | Xs]).
@@ -2850,125 +2972,6 @@
:- pragma foreign_export("IL", (list.cons(in, in) = (out)), "ML_cons").
%-----------------------------------------------------------------------------%
-%-----------------------------------------------------------------------------%
-% Ralph Becket <rwab1 at cam.sri.com> 27/04/99
-% Function forms added.
-
-list.det_head([]) = _ :-
- error("list.det_head/1: empty list as argument").
-list.det_head([X | _]) = X.
-
-list.det_tail([]) = _ :-
- error("list.det_tail/1: empty list as argument").
-list.det_tail([_ | Xs]) = Xs.
-
-list.head([X | _]) = X.
-
-list.tail([_ | Xs]) = Xs.
-
-list.append(Xs, Ys) = Zs :-
- list.append(Xs, Ys, Zs).
-
-list.merge(Xs, Ys) = Zs :-
- list.merge(Xs, Ys, Zs).
-
-list.merge_and_remove_dups(Xs, Ys) = Zs :-
- list.merge_and_remove_dups(Xs, Ys, Zs).
-
-list.remove_adjacent_dups(Xs) = Ys :-
- list.remove_adjacent_dups(Xs, Ys).
-
-list.remove_dups(Xs) = Ys :-
- list.remove_dups(Xs, Ys).
-
-list.length(Xs) = N :-
- list.length(Xs, N).
-
-list.take_upto(N, Xs) = Ys :-
- list.take_upto(N, Xs, Ys).
-
-list.delete_all(Xs, A) = Ys :-
- list.delete_all(Xs, A, Ys).
-
-list.delete_elems(Xs, Ys) = Zs :-
- list.delete_elems(Xs, Ys, Zs).
-
-list.replace_all(Xs, A, B) = Ys :-
- list.replace_all(Xs, A, B, Ys).
-
-list.replace_nth_det(Xs, N, A) = Ys :-
- list.replace_nth_det(Xs, N, A, Ys).
-
-list.det_replace_nth(Xs, N, A) = Ys :-
- list.replace_nth_det(Xs, N, A, Ys).
-
-list.sort_and_remove_dups(Xs) = Ys :-
- list.sort_and_remove_dups(Xs, Ys).
-
-list.sort(Xs) = Ys :-
- list.sort(Xs, Ys).
-
-list.reverse(Xs) = Ys :-
- list.reverse(Xs, Ys).
-
-list.index0_det(Xs, N) = A :-
- list.index0_det(Xs, N, A).
-
-list.det_index0(Xs, N) = A :-
- list.index0_det(Xs, N, A).
-
-list.index1_det(Xs, N) = A :-
- list.index1_det(Xs, N, A).
-
-list.det_index1(Xs, N) = A :-
- list.index1_det(Xs, N, A).
-
-list.zip(Xs, Ys) = Zs :-
- list.zip(Xs, Ys, Zs).
-
-list.duplicate(N, A) = Xs :-
- list.duplicate(N, A, Xs).
-
-list.condense(Xss) = Ys :-
- list.condense(Xss, Ys).
-
-list.chunk(Xs, N) = Ys :-
- list.chunk(Xs, N, Ys).
-
-list.map(_F, []) = [].
-list.map(F, [H | T]) = [F(H) | list.map(F, T)].
-
-list.foldl(F, Xs, A) = B :-
- P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
- list.foldl(P, Xs, A, B).
-
-list.foldr(F, Xs, A) = B :-
- P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
- list.foldr(P, Xs, A, B).
-
-list.filter(P, Xs) = Trues :-
- list.filter(P, Xs, Trues).
-
-list.negated_filter(P, Xs) = Falses :-
- list.negated_filter(P, Xs, Falses).
-
-list.filter_map(F, Xs) = Ys :-
- P = ( pred(X::in, Y::out) is semidet :- Y = F(X) ),
- list.filter_map(P, Xs, Ys).
-
-list.sort(F, Xs) = Ys :-
- P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
- list.sort(P, Xs, Ys).
-
-list.merge(F, Xs, Ys) = Zs :-
- P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
- list.merge(P, Xs, Ys, Zs).
-
-list.merge_and_remove_dups(F, Xs, Ys) = Zs :-
- P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
- list.merge_and_remove_dups(P, Xs, Ys, Zs).
-
-%-----------------------------------------------------------------------------%
L1 ++ L2 = list.append(L1, L2).
@@ -2986,7 +2989,7 @@
list.series_2(I, OK, Succ, !Series) :-
( OK(I) ->
- !:Series = [ I | !.Series ],
+ !:Series = [I | !.Series],
list.series_2(Succ(I), OK, Succ, !Series)
;
true
@@ -3009,6 +3012,20 @@
%-----------------------------------------------------------------------------%
+list.head([X | _]) = X.
+
+list.det_head([]) = _ :-
+ error("list.det_head/1: empty list as argument").
+list.det_head([X | _]) = X.
+
+list.tail([_ | Xs]) = Xs.
+
+list.det_tail([]) = _ :-
+ error("list.det_tail/1: empty list as argument").
+list.det_tail([_ | Xs]) = Xs.
+
+%-----------------------------------------------------------------------------%
+
inst_preserving_append([], L) = L.
inst_preserving_append([H | T], L) = [H | NT] :-
inst_preserving_append(T, L) = NT.
@@ -3150,4 +3167,5 @@
").
%-----------------------------------------------------------------------------%
+:- end_module list.
%-----------------------------------------------------------------------------%
Index: library/stack.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/stack.m,v
retrieving revision 1.26
diff -u -r1.26 stack.m
--- library/stack.m 2 Jun 2008 04:55:00 -0000 1.26
+++ library/stack.m 9 May 2011 13:03:44 -0000
@@ -57,12 +57,18 @@
%
:- pred stack.top(stack(T)::in, T::out) is semidet.
- % `stack.top_det' is like `stack.top' except that it will
+ % `stack.det_top' is like `stack.top' except that it will
% call error/1 rather than failing if given an empty stack.
%
+:- pred stack.det_top(stack(T)::in, T::out) is det.
+:- func stack.det_top(stack(T)) = T.
+
+ % Obsolete synonyms for the above.
+ %
+:- pragma obsolete(stack.top_det/2).
:- pred stack.top_det(stack(T)::in, T::out) is det.
+:- pragma obsolete(stack.top_det/1).
:- func stack.top_det(stack(T)) = T.
-:- func stack.det_top(stack(T)) = T.
% `stack.pop(Stack0, Elem, Stack)' is true iff `Stack0' is
% a non-empty stack whose top element is `Elem', and `Stack'
@@ -70,11 +76,12 @@
%
:- pred stack.pop(stack(T)::in, T::out, stack(T)::out) is semidet.
- % `stack.pop_det' is like `stack.pop' except that it will
+ % `stack.det_pop' is like `stack.pop' except that it will
% call error/1 rather than failing if given an empty stack.
%
-:- pred stack.pop_det(stack(T)::in, T::out, stack(T)::out) is det.
:- pred stack.det_pop(stack(T)::in, T::out, stack(T)::out) is det.
+:- pragma obsolete(stack.pop_det/3).
+:- pred stack.pop_det(stack(T)::in, T::out, stack(T)::out) is det.
% `stack.depth(Stack, Depth)' is true iff `Stack' is a stack
% containing `Depth' elements.
@@ -94,6 +101,9 @@
:- type stack(T)
---> stack(list(T)).
+stack.init = S :-
+ stack.init(S).
+
stack.init(stack([])).
stack.is_empty(stack([])).
@@ -101,8 +111,14 @@
stack.is_full(_) :-
semidet_fail.
+stack.push(S1, X) = S2 :-
+ stack.push(S1, X, S2).
+
stack.push(stack(Elems), Elem, stack([Elem | Elems])).
+stack.push_list(S1, Xs) = S2 :-
+ stack.push_list(S1, Xs, S2).
+
stack.push_list(Stack, [], Stack).
stack.push_list(Stack0, [Elem | Elems], Stack1) :-
stack.push(Stack0, Elem, Stack2),
@@ -110,50 +126,41 @@
stack.top(stack([Elem | _]), Elem).
-stack.top_det(Stack, Elem) :-
+stack.det_top(S) = X :-
+ stack.det_top(S, X).
+
+stack.det_top(Stack, Elem) :-
(
Stack = stack([Elem | _])
;
Stack = stack([]),
- error("stack.top_det: top of empty stack")
+ error("stack.det_top: top of empty stack")
).
+stack.top_det(S) = stack.det_top(S).
+stack.top_det(S, E) :-
+ stack.det_top(S, E).
+
stack.pop(stack([Elem | Elems]), Elem, stack(Elems)).
-stack.pop_det(Stack0, Elem, Stack) :-
+stack.det_pop(Stack0, Elem, Stack) :-
(
Stack0 = stack([Elem | Elems]),
Stack = stack(Elems)
;
Stack0 = stack([]),
- error("stack.pop_det: pop from empty stack")
+ error("stack.det_pop: pop from empty stack")
).
-stack.det_pop(Stack0, Elem, Stack) :-
- stack.pop_det(Stack0, Elem, Stack).
+stack.pop_det(Stack0, Elem, Stack) :-
+ stack.det_pop(Stack0, Elem, Stack).
+
+stack.depth(S) = N :-
+ stack.depth(S, N).
stack.depth(stack(Elems), Depth) :-
list.length(Elems, Depth).
%--------------------------------------------------------------------------%
+:- end_module stack.
%--------------------------------------------------------------------------%
-% Ralph Becket <rwab1 at cl.cam.ac.uk> 29/04/99
-% Function forms added.
-
-stack.init = S :-
- stack.init(S).
-
-stack.push(S1, X) = S2 :-
- stack.push(S1, X, S2).
-
-stack.push_list(S1, Xs) = S2 :-
- stack.push_list(S1, Xs, S2).
-
-stack.top_det(S) = X :-
- stack.top_det(S, X).
-
-stack.det_top(S) = X :-
- stack.top_det(S, X).
-
-stack.depth(S) = N :-
- stack.depth(S, N).
Index: library/string.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.306
diff -u -r1.306 string.m
--- library/string.m 4 Apr 2011 07:10:40 -0000 1.306
+++ library/string.m 9 May 2011 15:30:39 -0000
@@ -3995,14 +3995,14 @@
split_at_exponent(Str, Float, Exponent) :-
FloatAndExponent = string.words_separator(is_exponent, Str),
- list.index0_det(FloatAndExponent, 0, Float),
- list.index0_det(FloatAndExponent, 1, Exponent).
+ list.det_index0(FloatAndExponent, 0, Float),
+ list.det_index0(FloatAndExponent, 1, Exponent).
:- pred split_at_decimal_point(string::in, string::out, string::out) is det.
split_at_decimal_point(Str, Mantissa, Fraction) :-
MantAndFrac = string.words_separator(is_decimal_point, Str),
- list.index0_det(MantAndFrac, 0, Mantissa),
+ list.det_index0(MantAndFrac, 0, Mantissa),
( list.index0(MantAndFrac, 1, Fraction0) ->
Fraction = Fraction0
;
Index: ssdb/ssdb.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/ssdb/ssdb.m,v
retrieving revision 1.38
diff -u -r1.38 ssdb.m
--- ssdb/ssdb.m 8 May 2011 16:02:23 -0000 1.38
+++ ssdb/ssdb.m 9 May 2011 15:38:02 -0000
@@ -974,7 +974,7 @@
stack_index(Num, Frame, !IO) :-
get_shadow_stack(Stack, !IO),
- list.index0_det(Stack, Num, Frame).
+ list.det_index0(Stack, Num, Frame).
:- pred stack_depth(int::out, io::di, io::uo) is det.
@@ -1023,7 +1023,7 @@
nondet_stack_index(Num, Frame, !IO) :-
get_nondet_shadow_stack(Stack, !IO),
- list.index0_det(Stack, Num, Frame).
+ list.det_index0(Stack, Num, Frame).
:- pred nondet_stack_depth(int::out, io::di, io::uo) is det.
--------------------------------------------------------------------------
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