[mercury-users] uniqueness

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Oct 4 00:36:17 AEST 1999


On 03-Oct-1999, Robert Ernst Johann JESCHOFNIK <rejj at cat.cs.mu.OZ.AU> wrote:
> I am rather  vague on the uniqueness of types/objects, and how/when to use
> uniqueness information...
> 
> If I were to represent a matrix of floats as follows:
> :- type f_matrix --->
>         f_matrix(
>                   int, % M
>                   int, % N
>                   array(float)
>                 ).
> 
> what implications would that have when I deconstruct some object of type
> f_matrix to do an array__set, for example? (using destructive update)

Currently we don't support nested unique modes.

When we support nested unique modes, then the object that you deconstruct
would need to have the following inst

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

in order for the array__set call to work.

> Do I actually have to use uniq_array(float) instead?

`uniq_array(float)' doesn't make sense.  `uniq_array/1' is an inst
constructor, not a type constructor, so its argument is an inst, not a
type.  That's why I used `uniq_array(ground)'.

> Do those two integers also have to be unique, to keep the whole f_matrix unique?

They would have to be unique to keep the whole f_matrix unique.
But the f_matrix need not be wholly unique in order to use destructive update;
it should be possible to have some parts unique and other parts shared,
and to do destructive update only on the unique parts.

But as I said, currently we don't support nested unique modes.

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