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

Peter Moulder pmoulder at csse.monash.edu.au
Tue Jan 21 17:25:33 AEDT 2003


On Tue, Jan 21, 2003 at 03:03:26PM +1100, Ralph Becket wrote:

> +    % table([[X11, ..., X1N], ..., [XM1, ..., XMN]]) constructs a table
> +    % of size M * N.

I suggest documenting what guarantee you make for bounds(table([]));
I expect that a common source of bug (though rarely triggered) in user
code would be to make assumptions about the second argument of bounds,
forgetting that this second argument will have a strange value in the
rare case when the input to table(list(T)) is an empty list.  Explicitly
mentioning this should reduce the frequency of such a bug.

> +    ( size(A) \= M * N =>
> +        error("table.table/1: non-rectangular list of lists") ).

I believe this needs to be an if-then-else to be guaranteed safe for
implementations of commutative operational semantics.  I'm not aware of
any requirement that the `size(A) = M * N' disjunct be executed before
the erroneous disjunct.


Other than that, table.m looks good.

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