[mercury-users] still the Tuple Construction

Fergus Henderson fjh at cs.mu.OZ.AU
Thu May 15 18:51:49 AEST 2003


On 15-May-2003, Goncalo Jorge Coelho e Silva <l10454 at alunos.uevora.pt> wrote:
> 
> > I would suggest you to forget the 'construct' predicates at all. In 
> >general, you construct term just by typing them. Also, forget the 
> >'construct_tuple' predicate and construct the tuples using the {,} 
> >syntax. (See the section Syntax in the Language Reference). 
> 
>  I was unable to find such tuple construction
> reference :(( 

The relevant text is quoted below.

 Chapter "Syntax", section "Data-terms":

 | A tuple term is a left curly bracket (i.e. an open_curly token) followed
 | by a sequence of argument terms separated by commas, and a right curly
 | bracket. For example, {1, '2', "three"} is a valid tuple term. 

 Chapter "Types", section "Builtin types":

 | Tuple types: {},  {T},  {T1, T2},  ....
 | 
 |     A tuple type is equivalent to a discriminated union type (see section
 |     Discriminated unions) with declaration 
 | 
 |         :- type {Arg1, Arg2, ..., ArgN}
 | 	            ---> { Arg1, Arg2, ..., ArgN }.

>  What I intended to do with 'construct' and 'construct_tuple'
> was to built a predicate that given a string and a list
> of arguments, would construct Ralph's tuples as in:
> 
> "set_value(Address, Value)" 
>  or 
> "get_structure(FunctorArity/Register)"

I don't know what you mean by that, I'm afraid.

>  About using the '{'and '}' for tuple
> constructing:
> 
>  Sorry, but I'm not sure what's does your 
> >  Univ = {1,2}
> line represents. A tuple (int,int) with int 1 and int 2?

Yes.  A tuple of type {int,int} (this is tuple notation, not set notation!)
whose two elements both have type int and have values 1 and 2 respectively.

> I'm a little tired by the current time so, I hope I have made my question
> clear... :)

Not really, or at least not to me.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- 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