[m-rev.] New library module: table.m

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jan 22 22:08:32 AEDT 2003


On 22-Jan-2003, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> Here's the full diff:

The new module should be mentioned in the NEWS file.

> +array2d(Xss @ [Xs | _]) =
> +    ( if 
> +        M = length(Xss),
> +        N = length(Xs),
> +        all [Ys] ( member(Ys, Xss) => length(Ys) = N )
> +      then
> +        array2d(M, N, array(condense(Xss)))
> +      else
> +        func_error("array2d.array2d/1: non-rectangular list of lists")
> +    ).

I recommend moving the `M = length(Xss)' and `N = length(Xs)' unifications
to outside the if-then-else.

> +lists_2(IJ, J, N, A, Xs, Xss) =
> +    ( if 0 =< IJ then
> +        ( if 0 =< J then

I recommend writing that as `if IJ >= 0' and `if J >= 0'.

Otherwise that looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list