[m-dev.] Diff: Error message in assoc_list
David Glen JEFFERY
dgj at cs.mu.oz.au
Tue Jul 1 13:56:44 AEST 1997
> Estimated hours taken: 0.4
>
> Better reporting in assoc_list__from_corresponding_lists/3.
>
[...]
> Index: library/assoc_list.m
> ===================================================================
> RCS file: /home/staff/zs/imp/mercury/library/assoc_list.m,v
> retrieving revision 1.4
> diff -u -r1.4 assoc_list.m
> --- assoc_list.m 1996/04/16 06:08:31 1.4
> +++ assoc_list.m 1997/07/01 02:12:39
> @@ -64,7 +64,7 @@
>
> :- implementation.
>
> -:- import_module require, set.
> +:- import_module require, set, string.
>
> assoc_list__reverse_members([], []).
> assoc_list__reverse_members([K - V | KVs], [V - K | VKs]) :-
> @@ -74,7 +74,25 @@
> ( assoc_list__from_corresponding_2(Ks, Vs, KVs0) ->
> KVs = KVs0
> ;
> - error("assoc_list__from_corresponding_lists: lists have different lengths.")
> + KeyType = type_name(type_of(Ks)),
> + list__length(Ks, KeyLength),
> + string__int_to_string(KeyLength, KeyLengthString),
> + ValueType = type_name(type_of(Vs)),
> + list__length(Vs, ValueLength),
> + string__int_to_string(ValueLength, ValueLengthString),
> + string__append_list(
The indentation is a bit funny here. You have mixed tabs and spaces.
Other than that, it looks fine.
love and cuddles,
dgj
--
This .sig deliberately left blank
More information about the developers
mailing list