[m-dev.] Is this a bug?

Peter Schachte schachte at csse.unimelb.edu.au
Mon Jun 18 14:41:53 AEST 2007

Julien Fischer wrote:
> On Mon, 18 Jun 2007, Ralph Becket wrote:

>> This is somewhat counterintuitive.
> How so?  If there were two updates being done, then shouldn't I
> expect to see two `:='s.

Not necessarily.  X1 = X ^ y ^ z := u always does two updates.  The problem
here is that y might not be mapped in the map X, so X ^ elem(y) fails.
Switching to X ^ det_elem(y) would just throw an exception.

The reason it's counterintuitive is I think Ralph's using two maps here to
simulate a sparse 2D array.  In that context, one doesn't expect the second
dimension not to be there at all just because you haven't inserted something
with a particular first index yet.

Ralph:  could you instead use a single map from pairs of values?

Peter Schachte              One thing's for sure: if we keep doing what
schachte at cs.mu.OZ.AU        we're doing, we're going to keep getting what
www.cs.mu.oz.au/~schachte/  we're getting.
Phone: +61 3 8344 1338          -- Stephen Covey, et al.
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au

More information about the developers mailing list