defining operators

View: New views
3 Messages — Rating Filter:   Alert me  

defining operators

by Brianna Laugher-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am trying to get SWI Prolog to load (but not run) my non-SWI-Prolog,
in order to experiment with using pldoc.

(firstly, I assume SWI prolog doesn't mind Prolog files with .pro
extensions?)

[brianna@skip banksiadoc]$ pldoc -l ops.pro test.pro
ERROR: /home/brianna/banksiadoc/ops.pro:1:
        No permission to modify static_procedure `op/3'
Processing test (/home/brianna/banksiadoc/test.pro)... ERROR: tmp:1020:
        Prolog initialisation failed:
        tmp:1020:8: Syntax error: Operator expected


The problem is with the operator '?='.

In ops.pro, I have just one line:

op(700,xfx,?=).


But in pl itself:

?- op(700,xfx,?=).
true.


I don't understand why I can do this without error in interactive
Prolog, but not in a separate file.

Any suggestions?

thanks,
Brianna

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...

Re: defining operators

by Pierpaolo BERNARDI-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 4/30/08, Brianna Laugher <briannalaugher@...> wrote:

> Hi,
>
> I am trying to get SWI Prolog to load (but not run) my non-SWI-Prolog,
> in order to experiment with using pldoc.
>
> (firstly, I assume SWI prolog doesn't mind Prolog files with .pro
> extensions?)
>
> [brianna@skip banksiadoc]$ pldoc -l ops.pro test.pro
> ERROR: /home/brianna/banksiadoc/ops.pro:1:
>        No permission to modify static_procedure `op/3'
> Processing test (/home/brianna/banksiadoc/test.pro)... ERROR: tmp:1020:
>        Prolog initialisation failed:
>        tmp:1020:8: Syntax error: Operator expected
>
>
> The problem is with the operator '?='.
>
> In ops.pro, I have just one line:
>
> op(700,xfx,?=).

In source files you should write:   :- op(...).

Otherwise you are trying to modify the built-in op procedure.

Cheers
P.

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...

Re: defining operators

by Brianna Laugher-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2008-04-30 at 11:39 +0200, Pierpaolo Bernardi wrote:
> > The problem is with the operator '?='.
> >
> > In ops.pro, I have just one line:
> >
> > op(700,xfx,?=).
>
> In source files you should write:   :- op(...).
>
> Otherwise you are trying to modify the built-in op procedure.

Thanks, Pierpaolo (and others who supplied this answer offlist).

Brianna

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...