[mercury-users] string

Ralph Becket rbeck at microsoft.com
Mon Dec 6 23:39:04 AEDT 1999

> From: Robert Ernst Johann JESCHOFNIK [mailto:rejj at cat.cs.mu.OZ.AU]
> Sent: 03 December 1999 14:22
> > Hmm, maybe it'd be an idea to write an immutable vector type module on
> > of arrays, using dodgy C stuff to convince the compiler that the vectors
> > needn't be unique objects.
> Wouldn't that be the other way around? You want the vector to be unique,
> and you also want to belt the compiler into submission when you tell it
> that it contains unique objects, too..
> If the vector was not unique, surely that would cause all sorts of
> performance issues.

No, I want to construct fixed (i.e. immutable) arrays and have multiple
references to each.  That means the immutable array objects cannot be
and as Fergus pointed out it doesn't take any magic at all to make this
happen - mode inference will do the job as soon as you pass one as an `in'
argument.  I would certainly expect a performance gain from this
since array cells are (a) going to be contiguous in memory and (b) don't
connecting cons cells and (c) array accesses involve only one level of
indirection rather than the two needed to go via a cons cell.

> But then again, since when has Prolog been fast, anyway? ;)

The trick in these planning/theorem proving applications is ensuring you
don't do any worse!

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