[m-rev.] for post-commit review: improve multi_map.m

Julien Fischer jfischer at opturion.com
Wed Sep 2 22:34:11 AEST 2015


Hi Zoltan,

On Tue, 1 Sep 2015, Zoltan Somogyi wrote:

> Before commit, I will also put related predicates together,
> but this diff is easier to review.

...

> diff --git a/library/multi_map.m b/library/multi_map.m
> index 840a9c1..689fa40 100644
> --- a/library/multi_map.m
> +++ b/library/multi_map.m

...

> -    % Convert a pair of lists (which must be of the same length)
> -    % to a multi_map.
> +    % Convert the corresponding elements of a list of keys and a
> +    % list of values (which must be of the same length) to a multi_map.

This should say what happens if the list of keys and list of values are
*not* the same length.

> +    % A key may occur more than once in the list of keys.
>      %
>  :- func from_corresponding_lists(list(K), list(V))
>      = multi_map(K, V).
>  :- pred from_corresponding_lists(list(K)::in, list(V)::in,
>      multi_map(K, V)::out) is det.
> 
> -    % Convert a pair of lists (which must be of the same length)
> +    % Convert the corresponding elements of a list of keys and a
> +    % *list of lists* of values (which must be of the same length)

And here.

>      % to a multi_map.
> +    % A key may *not* occur more than once in the list of keys.
>      %
>  :- func from_corresponding_list_lists(list(K), list(list(V)))
>      = multi_map(K, V).
>  :- pred from_corresponding_list_lists(list(K)::in, list(list(V))::in,
>      multi_map(K, V)::out) is det.

The rest looks fine.

Julien.



More information about the reviews mailing list