[mercury-users] uniqueness

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Oct 4 02:52:24 AEST 1999


On 04-Oct-1999, Robert Ernst Johann JESCHOFNIK <rejj at cat.cs.mu.OZ.AU> wrote:
> Am I correct in saying that the above code only works because of the
> work-around in the array library, where uniq_array isn't really a unique
> inst, but bound instead?

Yes, that's the only reason why it works at the moment.

But once we get support for nested unique modes working,
then that code will work fine, even once the work-around in the
array library is removed.

...
> :- inst uniq_f_matrix(I, J, K) = unique(f_matrix(I, J, K)).
> :- inst uniq_f_matrix == uniq_f_matrix(ground, ground, uniq_array).
...
> I wrote most of that inst code without having any idea really what I was
> doing... It was more a case of copying style/syntax from declarations I
> see in the library modules; but, having done it, I think I actually get
> the drift of what is going on as I read back over it.

Good ;-)

> (Although, I am
> still not sure why the f_matrix(I, J, K) line is needed, and similarly
> unsure why you can only use type variables in it.)

The variables `I, J, K' there are inst variables, not type variables.
That line is not needed.  If you want, you could just use

    :- inst uniq_f_matrix == unique(f_matrix(ground, ground, uniq_array)).

and indeed in this case it would probably make more sense to do it that way.

-- 
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.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list