[mercury-users] boolean expressions from semidet predicates

Nicholas Nethercote njn at csse.unimelb.edu.au
Fri May 12 02:18:06 AEST 2006


On Sun, 23 Apr 2006, Mark Brown wrote:

>> I want to write something like this:
>>
>>   require((0 < X) and (X < 10))
>>
>> But I can't work out if it's possible to combine semidet operations in this
>> way.  'and' doesn't work, '/\' doesn't work (I'm not even sure what 'and'
>> and '/\' are, since the reference manual seems to only list the operators
>> without explaining what they do),
>
> 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?

> As for what they "are": `/\' is ISO-Prolog and `and' is an NU-Prolog
> extension.

What are their types?

> The argument to require/1 is a closure.  You can use an explicit lambda
> expression or use the `Term(Args)' shorthand (of which `0 < X' is an
> example).

Is there a way to easily write an equality as a closure?  (And a lambda 
expression doesn't count as easy in my book.)  Eg. is there a built-in 
predicate equals/2 that is the same as '=', or similar?

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