[m-rev.] for post-commit review: organize array.m, bt_array.m and pprint.m

Julien Fischer jfischer at opturion.com
Sun Jun 12 13:41:43 AEST 2022


On Sat, 11 Jun 2022, Zoltan Somogyi wrote:

> 2022-06-11 13:52 GMT+10:00 "Julien Fischer" <jfischer at opturion.com>:
>> I think the 'head' versions should be present in all three modules
>> and cord.get_first shoulde be deprecated and eventually removed.
>
> In cord.m, get_first is next to get_last; it does not make sense to have
> the latter without the former. List.m does not have get_last, but it does have
> just "last".

The general principle is that modules that provide a sequence ADT should
have (as far as possible) a consistent interface.

> In any case, that is a different change than this one, which implements
> the predicates you asked for. For your review.

...

> Add more functionality to ra_list.m.
> 
> The changes to cord.m and list.m are to reduce unnecessary differences
> between cord.m, list.m, and ra_list.m.
> 
> library/ra_list.m:
>     Add new procedures singleton, is_empty, is_not_empty, is_singleton,
>     length, list_to_ra_list, map, foldl and foldr.
>
>     Make ra_list_to_list operate without unnecessary memory allocations.
> 
> library/cord.m:
>     Add a semidet predicate head as a synonym for get_first.
> 
> library/list.m:
>     Add a semidet predicate is_singleton.
>
>     Add semidet predicates head and tail next to their semidet function
>     versions (which should be deprecated). Document them.
>
>     Add det predicates det_head and det_tail next to their semidet function
>     versions (which should be deprecated).

Do you mean the their det function versions there? And I don't think the det
function versions should be deprecated.

>     Avoid the overhead of calling a closure used for func-to-pred conversion
>     once for each list element in the function versions of foldl and foldr.
>
>     Fix some other documentation.
> 
> library/term_to_xml.m:
> tests/hard_coded/construct_packed.m:
>     Avoid ambiguities between function and predicate forms.
> 
> tests/hard_coded/ra_list_test.{m,exp}:
>     Add tests of length, list_to_ra_list, map, foldl and foldr.

The additions to the cord and list modules should be mentioned in the
NEWS file.

That looks fine otherwise.

Julien.


More information about the reviews mailing list