Subject: Re: [SWIPL]

From: Emerson Luís dos Santos <[email-masked]>
Date: Mon, 14 May 2001 14:35:43 -0300

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 [email-masked] 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) #
¢############################################################¢