[mercury-users] boolean expressions OR goals? (in IF clauses)

Ralph Becket rafe at cs.mu.OZ.AU
Tue May 27 09:58:29 AEST 2003


Goncalo Jorge Coelho e Silva, Monday, 26 May 2003:
> 
> Hi again,
> 
> highlighting the use of 'and' in if clauses
> and the (supposedly '~' [not?]) on the following
> code. Would this sample code be possible in mercury
> with these issues? 
> 
> >>>> if {(Tag = "REF") and (Value = Address)}

The comma is Mercury's "and" connective.

You write

	if   Condition1, Condition2, ..., ConditionN
	then ...
	else ...

Prefix "not" is Mercury's negation connective:

	if   Condition1, not Condition2, Condition3
	then ...
	else ...

or for compound goals

	if   not(Condition1, Condition2, Condition3)
	then ...
	else ...

> Also, which one is the 'not equal' symbol?
> 
> =\= @tab after @tab xfx @tab 700 
> \== @tab after @tab xfx @tab 700 
> \= @tab after @tab xfx @tab 700 
> ~= @tab after @tab xfx @tab 700 

`X \= Y' is shorthand for `not (X = Y)'

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