Operators reclaim.

460 views
Skip to first unread message

nicos.ang...@gmail.com

unread,
Nov 10, 2015, 5:55:48 PM11/10/15
to SWI-Prolog


Dear Jan, all

In the context of supporting R's logical operators in Real, a number of
SWI operator restrictions surfaced.

If any can be reclaimed, it would be greatly appreciated.


?- op( 400, xfx, != ).
ERROR: Syntax error: Unbalanced operator
ERROR: op( 400, xfx, !=
ERROR: ** here **
ERROR:  ) .

?- op(400,xfy, | ).
ERROR: Syntax error: Operand expected, unquoted comma or bar found
ERROR: op(400,xfy,
ERROR: ** here **
ERROR:  | ) .

[the following gets you stuck. need ^d to come out of inner prompt.]

?- op(400,xfy, || ).
|    .
|    ).
|    ).
|    ERROR: Stream user_input:28:2 Syntax error: end_of_file_in_quasi_quotation




?- op(400,xfy, ;; ).
ERROR: Syntax error: Unexpected `;' before `)'
ERROR: op(400,xfy, ;;
ERROR: ** here **
ERROR:  ) .
?-


Thanks in advance,

Nicos Angelopoulos
---
http://stoics.org.uk/~nicos

Pierpaolo Bernardi

unread,
Nov 10, 2015, 10:04:25 PM11/10/15
to nicos.ang...@gmail.com, SWI-Prolog
On Tue, Nov 10, 2015 at 11:55 PM, <nicos.ang...@gmail.com> wrote:
>
>
> Dear Jan, all
>
> In the context of supporting R's logical operators in Real, a number of
> SWI operator restrictions surfaced.
>
> If any can be reclaimed, it would be greatly appreciated.
>
>
> ?- op( 400, xfx, != ).
> ERROR: Syntax error: Unbalanced operator
> ERROR: op( 400, xfx, !=
> ERROR: ** here **
> ERROR: ) .

Quoting the operator does work:

4 ?- op(400,xfx,!=).
ERROR: Syntax error: Unbalanced operator
ERROR: op(400,xfx,!=
ERROR: ** here **
ERROR: ) .
4 ?- op(400,xfx,'!=').
true.

Jan Wielemaker

unread,
Nov 11, 2015, 2:49:41 AM11/11/15
to nicos.ang...@gmail.com, SWI-Prolog
Hi Nicos,

!|; are all solo characters in the Prolog syntax. Changing that
will introduce syntactical incompatibilities that will make few
people happy.

Sorry --- 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 http://groups.google.com/group/swi-prolog.
> For more options, visit https://groups.google.com/d/optout.

Nicos Angelopoulos

unread,
Nov 11, 2015, 4:01:51 PM11/11/15
to Jan Wielemaker, SWI-Prolog

Dear Jan,


Thanks for your email

On Wed, 11 Nov 2015 08:49:42 +0100
Jan Wielemaker <J.Wiel...@vu.nl> wrote:

> Hi Nicos,
>
> !|; are all solo characters in the Prolog syntax. Changing that
> will introduce syntactical incompatibilities that will make few
> people happy.
>
> Sorry --- Jan
>


1. given the contained use of !,
in the case of != I cannot think of any serious repercussions, probably missing something obvious.

2. in the case of || as far as I can see you are already doing something with it,
so the question is making further provisions


Regards,
Reply all
Reply to author
Forward
0 new messages