Files
mercury/library/svstack.m
Julien Fischer 3a74d3fd88 Change the argument order of some predicates in the stack and pqueue modules in
Branches: main

Change the argument order of some predicates in the stack and pqueue modules in
order to make them more conducive to the use of state variable notation.

library/pqueue.m:
library/stack.m:
	Change the argument ordering as above.

	Rename some variables in stack.m.

library/svpqueue.m:
library/svstack.m:
	Make the predicates exported by these modules as obsolete.

NEWS:
	Announce the above changes.

compiler/code_info.m:
compiler/delay_info.m:
compiler/ml_gen_info.m:
compiler/mode_constraint_robdd.m:
compiler/mode_ordering.m:
	Conform to the above changes.
2012-01-24 05:23:07 +00:00

77 lines
2.7 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
%---------------------------------------------------------------------------%
% Copyright (C) 2011-2012 The University of Melbourne.
% This file may only be copied under the terms of the GNU Library General
% Public License - see the file COPYING.LIB in the Mercury distribution.
%---------------------------------------------------------------------------%
%
% File: stack.m.
% Main author: fjh.
% Stability: high.
%
% This file provides an interface to the 'stack' ADT that is conducive to the
% use of state variable notation. The predicates here do the same thing as
% their counterparts in the stack module; the only difference is the order of
% the arguments.
%
%--------------------------------------------------------------------------%
:- module svstack.
:- interface.
:- import_module list.
:- import_module stack.
%--------------------------------------------------------------------------%
% `svstack.push(Elem, Stack0, Stack)' is true iff `Stack' is
% the stack which results from pushing `Elem' onto the top
% of `Stack0'.
%
:- pragma obsolete(svstack.push/3).
:- pred svstack.push(T::in, stack(T)::in, stack(T)::out) is det.
% `svstack.push_list(Elems, Stack0, Stack)' is true iff `Stack'
% is the stack which results from pushing the elements of the
% list `Elems' onto the top of `Stack0'.
%
:- pragma obsolete(svstack.push_list/3).
:- pred svstack.push_list(list(T)::in, stack(T)::in, stack(T)::out) is det.
% `svstack.pop(Elem, Stack0, Stack)' is true iff `Stack0' is
% a non-empty stack whose top element is `Elem', and `Stack'
% the stack which results from popping `Elem' off `Stack0'.
%
:- pragma obsolete(svstack.pop/3).
:- pred svstack.pop(T::out, stack(T)::in, stack(T)::out) is semidet.
% `svstack.det_pop' is like `svstack.pop' except that it will
% call error/1 rather than failing if given an empty stack.
%
:- pragma obsolete(svstack.det_pop/3).
:- pred svstack.det_pop(T::out, stack(T)::in, stack(T)::out) is det.
%--------------------------------------------------------------------------%
%--------------------------------------------------------------------------%
:- implementation.
%--------------------------------------------------------------------------%
svstack.push(E, !S) :-
stack.push(E, !S).
svstack.push_list(Es, !S) :-
stack.push_list(Es, !S).
svstack.pop(E, !S) :-
stack.pop(E, !S).
svstack.det_pop(E, !S) :-
stack.det_pop(E, !S).
%--------------------------------------------------------------------------%
:- end_module svstack.
%--------------------------------------------------------------------------%