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

Julien Fischer jfischer at opturion.com
Wed May 1 03:23:46 AEST 2013


On Tue, 30 Apr 2013, Peter Wang wrote:

> 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?

foldl is already documented; I've left foldr for now.

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

Done.

Cheers,
Julien.



More information about the reviews mailing list