On Friday 03 July 2009 03:45:31 pm Tobias Kuhn wrote:
> Jan Wielemaker wrote:
> > On Friday 03 July 2009 02:24:57 pm Paulo Moura wrote:
<snip>
> >> true.
> >>
> >> ?- write(<(a, b)).
> >> <(a, b)
> >> true.
>
> Thank you all for your replies!
>
> Actually, I should have read the manual more carefully where it cleary says
> "Precedence 0 removes the declaration". Sorry.
>
> > Note that there is a BIG price: If you try to load Prolog code after
> > this declaration that happens to use X < Y, you'll get a syntax error.
>
> Yes, this I encountered when trying it out. So I guess that retracting the
> operator "<" on a global level is a very bad idea.
Playing around globally with system operators must be deprecated (or
worse :-)
> It seems that the portray clause has to be defined in the module "user" and
> cannot be defined locally in a user-defined module. Right?
Yes. That is current practice in all Prolog systems that support
portray/1 AFAIK. It probably makes sense to first check the current
module before user.
> Is there a simple way to print out operators in normal predicate form (as
> write_canonical/1 does) but print out lists with the []-notation (as
> write/1 does)? This would solve my problem too.
AFAIK, the options that are shared with the standard or current practice
are compatible. The big question is still: what are you trying to do? If
it is about exchanging terms to another language you probably end up
with a partial solution if you try to tweak Prolog write. Use the XML
writer, JSON generator, etc. or roll your own.
The `best' route in SWI-Prolog is probably to make cancelation of
operators work inside modules. Afterall, the fact that that doesn't work
must be considered a bug.
Cheers --- Jan
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog