[mercury-users] tuple syntax

Peter Schachte schachte at cs.mu.OZ.AU
Thu Nov 11 14:39:01 AEDT 1999


On Thu, Nov 11, 1999 at 01:10:57PM +1100, David Glen JEFFERY wrote:
> > > 	 :- type (A,B) ---> (A,B).
> 
> I think my comment was that you *could* do that, and it would work, but the
> representation the compiler would use for n-tuples when n gets big wouldn't
> be terribly efficient.
> 
> eg. a five-tuple: (1,2,3,4,5) wouldn't be represented by five cells on the
> heap; each instance of the ','/2 functor effectively takes an extra cell,
> giving a total of nine (probably).

...

> Anyhow, this may not be an important consideration for many applications, and
> we could probably do a good job of optimising the representation if we tried.

Right.  There's been some discussion of "type unfolding" (or whatever
you want to call it; ie, when a term contains an argument A of a type
with only one alternative, replacing A with all the arguments of A).
This is a nice, general optimization (that unfortunately can lead to a
slowdown in some cases) that would solve this problem with tuples
quite nicely, and could be beneficial in other cases, as well.

-- 
Peter Schachte                     I don't have any solution, but I
mailto:schachte at cs.mu.OZ.AU        certainly admire the problem.
http://www.cs.mu.oz.au/~schachte/      -- Ashleigh Brilliant 
PGP: finger schachte at 128.250.37.3  
--------------------------------------------------------------------------
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