Re: \a^b
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
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 >