[m-dev.] for review: tuples [1]

Peter Schachte schachte at cs.mu.OZ.AU
Mon Aug 14 15:21:26 AEST 2000


On Mon, Aug 14, 2000 at 02:24:03PM +1000, Simon Taylor wrote:
> 
> > On 12-Aug-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > > The change allows (or at least I think it should allow) other uses for
> > > the symbols, so long as you specify the types enough to ensure that
> > > type inference can resolve any ambiguities.
> > 
> > Would it be acceptable to only accept the brace syntax as syntax for
> > tuples if you have imported the appropriate module (say `tuple')?
> > 
> > That way if you are keen on using {...} for set syntax, you can avoid
> > using the tuple module (or :- use_module it, so you require module
> > qualification if you do use it). 
> 
> I don't think that would work well. Terms with functor
> `{}' can have any arity, so you couldn't write the set
> constructor function in Mercury.

That's ok.  You'd have to write something like {[1,2,3]}, which should be
read as '{}'([1,2,3]).  Then you could write a function {list(T)} = set(T) is
det.  Not as pretty as without the square brackets, but still better than
list_to_set([1,2,3]).


-- 
Peter Schachte <schachte at cs.mu.OZ.AU>  We cannot accept that a state assumes
http://www.cs.mu.oz.au/~schachte/      the role of the world's policeman.
Phone:  +61 3 8344 9166                    -- Nelson Mandela 
Fax:    +61 3 9348 1184                
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list