From emerson@ppgia.pucpr.br Mon May 14 19:35:41 2001
Received: from hermes.ppgia.pucpr.br (ppgia.pucpr.br [200.192.116.20])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f4EHZd309974
	for <prolog@swi.psy.uva.nl>; Mon, 14 May 2001 19:35:40 +0200 (MET DST)
Received: from ppgia.pucpr.br (loki.ppgia.pucpr.br [10.32.2.224])
	by hermes.ppgia.pucpr.br (Postfix) with ESMTP id 93D3682B65
	for <prolog@swi.psy.uva.nl>; Mon, 14 May 2001 14:35:20 -0300 (BRT)
Sender: emerson@ppgia.pucpr.br
Message-ID: <3B00176E.781E17D9@ppgia.pucpr.br>
Date: Mon, 14 May 2001 14:35:43 -0300
From: Emerson =?iso-8859-1?Q?Lu=EDs?= dos Santos <emerson@ppgia.pucpr.br>
Organization: PPGIA - PUCPR
X-Mailer: Mozilla 4.73 [pt_BR] (X11; U; Linux 2.2.16-13cl i686)
X-Accept-Language: pt-BR, en
MIME-Version: 1.0
To: prolog@swi.psy.uva.nl
Subject: Re: [SWIPL]
References: <001b01c0dc6f$ba69f280$fc02efc3@unemployed>
Content-Type: multipart/alternative;
 boundary="------------4E73D76DEF6C5CAF405D5D98"


--------------4E73D76DEF6C5CAF405D5D98
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

u should take a look at the use of the type of operator (second argument of
op/3), by typing ?- help(op/3)
or looking for another explanation in some book
when u use xfy, u r telling Prolog the type of argument on the left side of the
operator should be a term with a lower precedence; however the second one may be
a term with a precedence lower or equal to the precedence of the functor
as u r trying to do it with a term which has a precedence equal to the precedence
of the functor (as they are the same operator, they have the same precedence),
Prolog will add  brackets in order to respect the definition of the operator in
op/3, because a term enclosed in brackets has precedence 0
if u want to get that result without any brackets, u have to declare it as

:- op(120, yfy, w).

then, the following query (intended by u)

?-  conc(a w b, c w d, X).

X = a w b w c w d

Yes

will succed the way u want it to


îÉËÏÌÁÊ æÅÄÏÒÏ× wrote:

> Hi.
>
> :- op(120, xfy,  w).
>
> conc(X, Y, X w Y).
>
> [debug]  ?- conc( a w b, c w d, X).
>    Call: (6) conc(a w b, c w d, _G404) ? creep
>    Exit: (6) conc(a w b, c w d,  (a w b)w c w d) ? creep
>
> X = (a w b)w c w d
>
> Yes
> [debug]  ?-
>
>     Why not  X = a w b w c w d ?
>     How can I eliminate this?
>
> Thanx one more time.
> /Nick/
>
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
>
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
>
> or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe"
> (without the quotes) and *no* message body.
>
> ** An ARCHIVE of this list is maintained at
>
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/

--

£############################################################£
#¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬ Emerson Luís dos Santos ¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬#
#************************************************************#
#! Mestrando - Laboratório AGP/Siemens.......................#
#! Grupo de Sistemas de Informação...........................#
#! Programa de Pós-Graduação em Informática Aplicada - PPGIA #
#! Pontifícia Universidade Católica do Paraná - PUCPR........#
#! ¹ Curitiba - ² Paraná - ³ Brasil..........................#
#************************************************************#
#___________ Powered by Projeto i-Doc (Intelligent Document) #
¢############################################################¢



--------------4E73D76DEF6C5CAF405D5D98
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
u should take a look at the use of the type of operator (second argument
of op/3), by typing ?- help(op/3)
<br>or looking for another explanation in some book
<br>when u use xfy, u r telling Prolog the type of argument on the left
side of the operator should be a term with a lower precedence; however
the second one may be a term with a precedence lower or equal to the precedence
of the functor
<br>as u r trying to do it with a term which has a precedence equal to
the precedence of the functor (as they are the same operator, they have
the same precedence), Prolog will add&nbsp; brackets in order to respect
the definition of the operator in op/3, because a term enclosed in brackets
has precedence 0
<br>if u want to get that result without any brackets, u have to declare
it as
<p>:- op(120, yfy, w).
<p>then, the following query (intended by u)
<p>?-&nbsp; conc(a w b, c w d, X).
<p>X = a w b w c w d
<p>Yes
<p>will succed the way u want it to
<br>&nbsp;
<p>&icirc;&Eacute;&Euml;&Iuml;&Igrave;&Aacute;&Ecirc; &aelig;&Aring;&Auml;&Iuml;&Ograve;&Iuml;&times;
wrote:
<blockquote TYPE=CITE>Hi.
<p>:- op(120, xfy,&nbsp; w).
<p>conc(X, Y, X w Y).
<p>[debug]&nbsp; ?- conc( a w b, c w d, X).
<br>&nbsp;&nbsp; Call: (6) conc(a w b, c w d, _G404) ? creep
<br>&nbsp;&nbsp; Exit: (6) conc(a w b, c w d,&nbsp; (a w b)w c w d) ? creep
<p>X = (a w b)w c w d
<p>Yes
<br>[debug]&nbsp; ?-
<p>&nbsp;&nbsp;&nbsp; Why not&nbsp; X = a w b w c w d ?
<br>&nbsp;&nbsp;&nbsp; How can I eliminate this?
<p>Thanx one more time.
<br>/Nick/
<p>----------------
<br>* To UNSUBSCRIBE, please use the HTML form at
<p>&nbsp;&nbsp;&nbsp; <a href="http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist">http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist</a>
<p>or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe"
<br>(without the quotes) and *no* message body.
<p>** An ARCHIVE of this list is maintained at
<p>&nbsp;&nbsp;&nbsp; <a href="http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/">http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/</a></blockquote>

<pre>--&nbsp;


&pound;############################################################&pound;
#&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not; Emerson Lu&iacute;s dos Santos &not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;&not;#
#************************************************************#
#! Mestrando - Laborat&oacute;rio AGP/Siemens.......................#
#! Grupo de Sistemas de Informa&ccedil;&atilde;o...........................#
#! Programa de P&oacute;s-Gradua&ccedil;&atilde;o em Inform&aacute;tica Aplicada - PPGIA #
#! Pontif&iacute;cia Universidade Cat&oacute;lica do Paran&aacute; - PUCPR........#
#! &sup1; Curitiba - &sup2; Paran&aacute; - &sup3; Brasil..........................#
#************************************************************#
#___________ Powered by Projeto i-Doc (Intelligent Document) #
&cent;############################################################&cent;</pre>
&nbsp;</html>

--------------4E73D76DEF6C5CAF405D5D98--

