[m-rev.] for review: improve documentation for map and bimap folds

Peter Wang novalazy at gmail.com
Tue Apr 30 14:35:35 AEST 2013


On Mon, 29 Apr 2013 14:45:30 +1000 (EST), Julien Fischer <jfischer at opturion.com> wrote:
> 
> For review by anyone.
> 
> The following were suggested by Peter Moulder back in January.
> (After the 13.05 release we should go through the standard library and
> have a careful look at the consistency -- or lack thereof -- in the
> documentation of common operations.)
> 
> ---------
> 
> Documentation clarifications for map and bimap folds.
> 
> library/bimap.m:
>  	Specify that foldl over a bimap is done by inorder traversal
>  	by key.
> 
> library/map.m:
>  	Likewise for foldl_values and map_foldl.

map.fold[lr]*, too?

> diff --git a/library/bimap.m b/library/bimap.m
> index 81f2abe..d04a5e8 100644
> --- a/library/bimap.m
> +++ b/library/bimap.m
> @@ -260,8 +260,8 @@
>   :- pred bimap.map_values(pred(K, V, W)::in(pred(in, in, out) is det),
>       bimap(K, V)::in, bimap(K, W)::out) is det.
> 
> -    % Perform a traversal of the bimap, applying an accumulator predicate
> -    % for each key-value pair.
> +    % Perform an inorder traversal by key of the bimap, applying an
> +    % accumulator predicate for each key-value pair.
>       %
>   :- func bimap.foldl(func(K, V, A) = A, bimap(K, V), A) = A.
>   :- pred bimap.foldl(pred(K, V, A, A), bimap(K, V), A, A).

Maybe

    Perform an inorder traversal of the bimap, by key, applying ...

but it's pretty minor.

Peter



More information about the reviews mailing list