for review: new library predicate
Thomas Charles CONWAY
conway at cs.mu.OZ.AU
Mon Feb 23 11:18:44 AEDT 1998
Hi
For whoever to review (trd? - you've already seen it once).
--
ZZ:wq!
^X^C
Thomas Conway conway at cs.mu.oz.au
AD DEUM ET VINUM Nail here [] for new monitor.
library/queue.m:
add a queue__delete_all predicate to remove instances of an element
from a queue.
Index: library/queue.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/queue.m,v
retrieving revision 1.18
diff -u -r1.18 queue.m
--- queue.m 1998/01/23 12:33:29 1.18
+++ queue.m 1998/02/19 04:09:00
@@ -89,6 +89,12 @@
:- pred queue__list_to_queue(list(T), queue(T)).
:- mode queue__list_to_queue(in, out) is det.
+ % `queue__delete_all(Queue0, Elem, Queue)' is true iff `Queue' is
+ % the same queue as `Queue0' with all occurences of `Elem' removed
+ % from it.
+:- pred queue__delete_all(queue(T), T, queue(T)).
+:- mode queue__delete_all(in, in, out) is det.
+
%--------------------------------------------------------------------------%
:- implementation.
@@ -157,5 +163,9 @@
Length is LengthOn + LengthOff.
queue__list_to_queue(List, [] - List).
+
+queue__delete_all(On0 - Off0, Elem, On - Off) :-
+ list__delete_all(On0, Elem, On),
+ list__delete_all(Off0, Elem, Off).
%--------------------------------------------------------------------------%
More information about the developers
mailing list