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

Goncalo Jorge Coelho e Silva l10454 at alunos.uevora.pt
Tue May 27 06:29:13 AEST 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)}

sample 1:

bind(HeapIn, HeapOut, AddressIn, RegistHashIn):-
         lookup(RegistHashIn, "h") = H,
         array__lookup(HeapIn, AddressIn, Tag),
         array__lookup(HeapIn, AddressIn+1, Value),
         %if {(Tag = "REF") and (Value = Address)} then
         if {(Tag = "REF")} then
                 array__set(HeapIn, AddressIn+1, H, HeapOut)
               HeapOut = HeapIn


>>>  if {(~(unify_aux(HeapIn, HeapOut, CounterIn1,CounterIn2,Arity))}

Sample 2:

if {(Tag1 = "STR") and (Tag2 = "STR") and (FuncAri1 = FuncAri2)} then
                 CounterIn1 = D1+1, CounterIn2 = D2+1,
                 if {(~(unify_aux(HeapIn, HeapOut, CounterIn1,CounterIn2,Arity))}
                          then Fail = 0
                             Fail = 1,
                             set(RegistHashIn,"fail", Fail) = RegistHashOut

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 


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