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

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jun 23 21:50:15 AEST 1998


On 23-Jun-1998, Peter David ROSS <petdr at cs.mu.OZ.AU> wrote:
> +	% list__replace_nth(List0, N, R, List) is true iff List is List0 
> +	% with Nth element replaced with R.
> +	% Aborts if N < 1 and fails if length of List0 < N.
> +	% (Position numbers start from 1.)
> +	%
> +:- pred list__replace_nth(list(T), int, T, list(T)).
> +:- mode list__replace_nth(in, in, in, out) is semidet.

I think it would be better to do the same thing in the N < 1 and N > length
cases -- either fail in both cases, or abort in both cases.

In fact it would make sense to have two versions, one that fails,
and the other (with a `_det' suffix on the name) that aborts.

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