[m-rev.] diff: add assoc_list.foldl_{keys,values}_only/4

Julien Fischer juliensf at csse.unimelb.edu.au
Fri May 27 17:45:34 AEST 2011


On Fri, 27 May 2011, Ian MacLarty wrote:

> On Fri, May 27, 2011 at 3:49 PM, Julien Fischer
> <juliensf at csse.unimelb.edu.au> wrote:
>>
>> Branches: main
>>
>> Add predicates for folding over only the keys or values of an association
>> list.
>>
>> library/assoc_list.m:
>>        Add the predicates foldl_keys_only/4 and foldl_values_only/4.
>>
>
> Wouldn't the names foldl_keys and foldl_values be sufficiently descriptive?

Yes.  I chose the current names for symmetery with
assoc_list.map_{keys,values}_only/3, but I now think the names you
suggest are better.

(For the map operation there is map_values/3 (where the closure takes
both the key and the value) and map_values_only/3 (where the closure
take just the value) -- this distinction doesn't need to be made for foldl
since if you want to fold over both the key and the value you can just
you list.foldl.)

I'll make this change shortly.

Julien.


More information about the reviews mailing list