Subject: Re: Q.1.1?

>>>>> "Shou-Kang,Wei" == Shou-Kang,Wei   writes:

   Shou-Kang,Wei> Hi,
   Shou-Kang,Wei> I tried (a) in 1.1 , I got this

   Shou-Kang,Wei> | ?- display(extreme(X) :- hi(X) ; lo(X)).

   Shou-Kang,Wei> {SYNTAX ERROR: in lines 45-46}
   Shou-Kang,Wei> ** , or ) expected in arguments **
   Shou-Kang,Wei> ?- display ( extreme ( X )
   Shou-Kang,Wei> ** here **
   Shou-Kang,Wei> :- hi ( X ) ; lo ( X ) ) .

   Shou-Kang,Wei> Is that meant we can not use ":-" and";" in "display" ?

I omitted to mention this subtlety.  It relates to the problem of
distinguishing between the comma as an operator and the comma as an
argument separator.  The comma operator has a precedence of 1000, which
is quite high but not the highest possible.  Several operators have a
higher precedence, including (:-) and semi-colon (;).  If these
operators appear in a context where the operator-as-argument-separator
can occur, the expression must be enclosed in parenthesis.  I.e. try

	?- display( (extreme(X) :- hi(X) ; lo(X)) ).

-- 
-- John Hamer                                Email: J.Hamer@cs.auckland.ac.nz
-- Department of Computer Science            Phone: +64 9 3737 599 x8758
-- University of Auckland                    Fax:   +64 9 3737 453
-- Private Bag 92019, Auckland, New Zealand.