[m-rev.] for review: map__init_singleton

Zoltan Somogyi zs at cs.mu.OZ.AU
Sun May 12 02:39:26 AEST 2002


For review by anyone.

library/map.m:
	Add a new predicate, map__init_singleton, that creates a new map
	containing one key-value pair.

Zoltan.

Index: map.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/map.m,v
retrieving revision 1.80
diff -u -b -r1.80 map.m
--- map.m	24 May 2001 02:32:28 -0000	1.80
+++ map.m	11 May 2002 10:34:17 -0000
@@ -37,6 +37,8 @@
 :- func map__init = map(K, V).
 :- mode map__init = uo is det.
 
+:- func map__init_singleton(K, V) = map(K, V).
+
 	% Check whether a map is empty.
 :- pred map__is_empty(map(_,_)).
 :- mode map__is_empty(in) is semidet.
@@ -786,6 +788,9 @@
 
 map__init = M :-
 	map__init(M).
+
+map__init_singleton(K, V) =
+	map__det_insert(map__init, K, V).
 
 map__search(M, K) = V :-
 	map__search(M, K, V).
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list