[m-rev.] Re: missing library documentation
Zoltan Somogyi
zs at cs.mu.OZ.AU
Mon Aug 19 16:32:45 AEST 2002
On 19-Aug-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> I noticed that there is no documentation for the library routines
> *_upper_bound_search and *_lower_bound_search. Could you please
> add some?
Done. Will you volunteer to document the rest of these modules :-)
Zoltan.
library/bintree.m:
library/map.m:
library/tree234.m:
Copy the documentation of the lower and upper search and lookup
predicates from rbtree.m to these modules as well.
cvs diff: Diffing .
Index: bintree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bintree.m,v
retrieving revision 1.42
diff -u -b -r1.42 bintree.m
--- bintree.m 2000/11/12 08:51:33 1.42
+++ bintree.m 2002/08/19 06:27:31
@@ -57,15 +57,27 @@
:- func bintree__lookup(bintree(K,V), K) = V.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next lower key instead.
+ % Fails if there is no key with the given or lower value.
:- pred bintree__lower_bound_search(bintree(K,V), K, K, V).
:- mode bintree__lower_bound_search(in, in, out, out) is semidet.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next lower key instead.
+ % Aborts if there is no key with the given or lower value.
:- pred bintree__lower_bound_lookup(bintree(K,V), K, K, V).
:- mode bintree__lower_bound_lookup(in, in, out, out) is det.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next higher key instead.
+ % Fails if there is no key with the given or higher value.
:- pred bintree__upper_bound_search(bintree(K,V), K, K, V).
:- mode bintree__upper_bound_search(in, in, out, out) is semidet.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next higher key instead.
+ % Aborts if there is no key with the given or higher value.
:- pred bintree__upper_bound_lookup(bintree(K,V), K, K, V).
:- mode bintree__upper_bound_lookup(in, in, out, out) is det.
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 2001/05/24 02:32:28 1.80
+++ map.m 2002/08/19 06:28:48
@@ -60,15 +60,27 @@
:- func map__lookup(map(K,V), K) = V.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next lower key instead.
+ % Fails if there is no key with the given or lower value.
:- pred map__lower_bound_search(map(K,V), K, K, V).
:- mode map__lower_bound_search(in, in, out, out) is semidet.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next lower key instead.
+ % Aborts if there is no key with the given or lower value.
:- pred map__lower_bound_lookup(map(K,V), K, K, V).
:- mode map__lower_bound_lookup(in, in, out, out) is det.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next higher key instead.
+ % Fails if there is no key with the given or higher value.
:- pred map__upper_bound_search(map(K,V), K, K, V).
:- mode map__upper_bound_search(in, in, out, out) is semidet.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next higher key instead.
+ % Aborts if there is no key with the given or higher value.
:- pred map__upper_bound_lookup(map(K,V), K, K, V).
:- mode map__upper_bound_lookup(in, in, out, out) is det.
Index: tree234.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/tree234.m,v
retrieving revision 1.35
diff -u -b -r1.35 tree234.m
--- tree234.m 2002/03/28 03:44:40 1.35
+++ tree234.m 2002/08/19 06:27:53
@@ -40,15 +40,27 @@
:- func tree234__lookup(tree234(K, V), K) = V.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next lower key instead.
+ % Fails if there is no key with the given or lower value.
:- pred tree234__lower_bound_search(tree234(K, V), K, K, V).
:- mode tree234__lower_bound_search(in, in, out, out) is semidet.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next lower key instead.
+ % Aborts if there is no key with the given or lower value.
:- pred tree234__lower_bound_lookup(tree234(K, V), K, K, V).
:- mode tree234__lower_bound_lookup(in, in, out, out) is det.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next higher key instead.
+ % Fails if there is no key with the given or higher value.
:- pred tree234__upper_bound_search(tree234(K, V), K, K, V).
:- mode tree234__upper_bound_search(in, in, out, out) is semidet.
+ % Search for a key-value pair using the key. If there is no entry
+ % for the given key, returns the pair for the next higher key instead.
+ % Aborts if there is no key with the given or higher value.
:- pred tree234__upper_bound_lookup(tree234(K, V), K, K, V).
:- mode tree234__upper_bound_lookup(in, in, out, out) is det.
--------------------------------------------------------------------------
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