[m-rev.] For review: Introduce stack.mamber/2 to standard library.

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Oct 16 11:50:15 AEDT 2008



On Wed, 15 Oct 2008, Paul Bone wrote:

>
> For review by anyone.
>
> Estimated Hours taken: 0.2
> Branches: main
>
> Introduce stack.member(Elem, Stack), which is true of Elem is somewhere
> within the stack Stack.
>
> library/stack.m:
> 	As above'
>
> NEWS:
> 	Announce the change.
>
> Index: NEWS
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/NEWS,v
> retrieving revision 1.497
> diff -u -p -b -r1.497 NEWS
> --- NEWS	23 Sep 2008 06:42:24 -0000	1.497
> +++ NEWS	11 Oct 2008 07:02:09 -0000
> @@ -122,6 +122,9 @@ Changes to the Mercury standard library:
> * We have changed the interface of the ops module to make lookups of operators
>   more efficient.
>
> +* The following predicates have been added to the stack module:
> +    stack.member/2
> +
> * We have added io.update_globals/3 which allows for atomic updates to
>   the globals field in the I/O state in the presence of multiple threads.
>
> Index: library/stack.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/stack.m,v
> retrieving revision 1.26
> diff -u -p -b -r1.26 stack.m
> --- library/stack.m	2 Jun 2008 04:55:00 -0000	1.26
> +++ library/stack.m	11 Oct 2008 06:58:21 -0000
> @@ -82,6 +82,10 @@
> :- pred stack.depth(stack(T)::in, int::out) is det.
> :- func stack.depth(stack(T)) = int.
>
> +    % 'stack.member(Elem, Stack)' is true iff 'Elem' is contained in the stack.
> +    %

I suggest:

 	... is true iff the stack contains `Elem'.

Julien.
--------------------------------------------------------------------------
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