[mercury-users] boolean expressions from semidet predicates

Mark Brown mark at cs.mu.OZ.AU
Mon May 15 09:49:08 AEST 2006


On 13-May-2006, Nicholas Nethercote <njn at csse.unimelb.edu.au> wrote:
> On Fri, 12 May 2006, Mark Brown wrote:
> 
> >>>It's only concrete syntax.  `X and Y' means the same thing as `and(X, 
> >>>Y)'.
> >>
> >>Which and/2 is this?  The one from bool.m?
> >
> >It's just a name, like `write_int', `++' or `foo'.  The meaning will of
> >course depend on the context in which it is used, following the same
> >overloading resolution rules as any other name.
> >
> >>>As for what they "are": `/\' is ISO-Prolog and `and' is an NU-Prolog
> >>>extension.
> >>
> >>What are their types?
> >
> >The types, if they even have them, are determined from the context.  But
> >these names can also be defined as typeclass names or user defined insts,
> >for example, in which case the concept of type does not apply.  Again,
> >they are just like any other names -- the fact that these particular names
> >can be written in infix operator form is only concrete syntax, and is
> >entirely orthogonal to the type system.
> 
> I'll try a different tack.  The following page of the Ref Manual lists 
> Mercury's built-in operators:
> http://www.cs.mu.oz.au/research/mercury/information/doc-latest/mercury_ref/Builtin-Operators.html#Builtin%20Operators
> 
> What does this table represent?

It is part of the specification of Mercury's concrete syntax.

> It has operators like '+', '++' and 'and', 

Yes, that means you can write `X and Y' instead of `and(X, Y)', etc.  As
I mentioned earlier, this has no impact on the semantics: both mean the
same thing.  Once Mercury has parsed the program, it no longer knows or
cares whether infix notation was used.

> but then there are functions int.+/2 and string.++/2 and bool.and/2.

Yes.  Where is the problem?

> Is 
> this table a relic from Mercury's Prolog heritage?

Only in the sense that Mercury's syntax itself is a relic from its Prolog
heritage.  ;-)

Cheers,
Mark.

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