[m-dev.] for review: additions to list module

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jun 23 17:20:56 AEST 1998


On 23-Jun-1998, Peter David ROSS <petdr at cs.mu.OZ.AU> wrote:
> Could someone please review this?
...
> Add some more utility functions into the list module.
> 
> library/list.m:
>     Add the predicateds list__repeat and list__replace_nth.

list__repeat apparently does the same thing as list__duplicate,
so it should not be added.

> +	% list__replace_nth(List0, N, R, List) is true iff List is List0 
> +	% with Nth element (starting from 1) replaced with R.

What happens if N =< 0 or if N > length of List0?

...
>  	% list__nth_member_search(List, Elem, Position):
> -	%	Elem is the Position'th member of List.
> +	%	Elem is the Position'th (starting from 1) member of List.

That's rather awkward wording, IMHO.  The fact that numbers start from
one is implicit in the use of the (also admittedly a little awkward) term
"Position'th".  If the numbers started from zero it would be the
"(Position + 1)'th" element.  If you want to spell it out, that's OK,
but I suggest you use a separate sentence:

	%	Elem is the Position'th member of List.
	%	(Position numbers start from 1.)

Please send another diff when you've addressed these concerns.  Thanks.

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