Can I re-define the forward slash inside a module??

13 views
Skip to first unread message

Pasi Xyy

unread,
Mar 11, 2018, 1:23:41 PM3/11/18
to SWI-Prolog
Hello Forum!

Can I re-define a forward slash for some internal use in the module, so that the operator-/ unaffected elsewhere? Possibly no I can't, so I wrote some code without redefinition.

The default is op(400,yfx,/) and I was hoping to redefine it to op(400,xfy,/). Also I tried op(400,xfy, somemodule:(/)) but that didn't work neither.

I tried just about anything. Also when I tried redefining the `/' in  (local) pengines and Prolog engines, the redefinition is not kept just locally, it seems to be always global??? 

Thanks.

Jan Wielemaker

unread,
Mar 11, 2018, 1:33:29 PM3/11/18
to Pasi Xyy, SWI-Prolog
Operators are local to the a module. So, yes you can redefine them.
I'd be very careful as it is easy to mess things up, but it works
as advertised. Only `I tried everything' doesn't help us much to know
what you tried. Send concrete source code we can load and run.

Cheers --- Jan
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
> <mailto:swi-prolog+...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/swi-prolog.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages