[m-dev.] Diff: Error message in assoc_list

Fergus Henderson fjh at cs.mu.oz.au
Tue Jul 1 14:21:14 AEST 1997


Andrew Bromage, you wrote:
> library/assoc_list.m:
> 	Change the error message in assoc_list__from_corresponding_lists
> 	so that it displays the types and lengths of the lists if they
> 	differ in length.
> 
> library/Mmakefile:
> library/assoc_list.nu.nl:
> 	Add a Prolog version of the above which doesn't display the types,
> 	make sure it's an overriding lib.

I think it would be a better idea to have a predicate version of
type_name/1, and to provide a Prolog predicate which overrides this,
rather than having Prolog code for each of assoc_list, map, etc.

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

Please fix the indentation (mixing spaces and tabs).
(And please carefully review your diffs for simple things like
this before posting.)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list