回复: \a^b
"Lumj" <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Cool. So working with \ (X:Y)^p(X,Y) is just fine. Thanks for your quick response:-) ------------------ 原始邮件 ------------------ 发件人: "Jan Wielemaker";<[email protected]>; 发送时间: 2013年12月11日(星期三) 晚上9:17 收件人: "Lumj"<[email protected]>; "SWI-Prolog"<[email protected]>; 主题: Re: [SWIPL] \a^b On 12/11/2013 01:56 PM, Lumj wrote: > In 6.4.1, I get following: > ?-\a^b=..L. > L=[\,a^b]. > ?-\(a)^b=..L. > L=[^,\a,b]. > As \ and ^ both have a precedence of 200, i want to know if there's any theory in the result? Because I have a tendency to think that the parentheses do not affect the association of terms outside them. > In fact this is preventing using lambda like this: > call(\(X:Y)^p(X,Y),x,y). It is a beautyful example :-) The trouble is that \(a) is read name(arg1, ...) rather than a prefix operator. So, in \a^b, both \ and ^ are operators and the precedence tells the system how to interpret this. In \(a)^b, \(a) is a compound which has precedence 0. That is also why you have to write \+ (a,b) rather than \+(a,b) which reads as \+ with two arguments. Cheers --- Jan > -------------- next part -------------- > HTML attachment scrubbed and removed > _______________________________________________ > SWI-Prolog mailing list > [email protected] > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog > -------------- next part -------------- HTML attachment scrubbed and removed _______________________________________________ SWI-Prolog mailing list [email protected] https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog