Open flexoron opened 2 months ago
Logtalk iso_op_3_10 needs to be changed to add Trealla to the conditional test @pmoura
ECLiPSe, Who else? SWI
$ eclipse
[eclipse 1]: op(1,fy,&).
[eclipse 2]: op(1,yf,&).
[eclipse 3]: op(1,xfx,&).
[eclipse 4]: [user].
&(x).
&(x,x).
[eclipse 5]: X&, &Y, X&Y.
X = x
Y = x
[eclipse 7]: X& .
X = x
$ tpl
?- op(1,fy,&).
true.
?- op(1,yf,&).
true.
?- op(1,xfx,&).
true.
?- [user].
&(x).
&(x,x).
?- current_op(X,Y,&).
X = 1, Y = fy
; X = 1, Y = yf
; X = 1, Y = xfx.
?- X&, &Y, X&Y.
Error: syntax error, quotes needed around operator ',', user:1
?- X& .
Error: syntax error, missing operand to infix, user:1
Also
$ tpl
?- op(1,yf,&).
true.
?- [user].
&(x).
true.
?- X& .
X = x.
?- X& , true.
Error: syntax error, quotes needed around operator ',', user:1 % Meaning?
?-
Yes, the change to allow both postfix & infix needs a tad more work.
On Thu, Sep 19, 2024 at 11:30 AM flexoron @.***> wrote:
ECLiPSe, Who else?
$ eclipse
&(x). &(x,x).
[eclipse 5]: X&, &Y, X&Y. X = x Y = x [eclipse 7]: X& . X = x
$ tpl ?- op(1,fy,&). true. ?- op(1,yf,&). true. ?- op(1,xfx,&). true. ?- [user]. &(x). &(x,x).
?- current_op(X,Y,&). X = 1, Y = fy ; X = 1, Y = yf ; X = 1, Y = xfx.
?- X&, &Y, X&Y. Error: syntax error, quotes needed around operator ',', user:1 ?- X& . Error: syntax error, missing operand to infix, user:1
— Reply to this email directly, view it on GitHub https://github.com/trealla-prolog/trealla/issues/596#issuecomment-2359733758, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNKSEV6PZ6CYNJCUS6TECLZXISNBAVCNFSM6AAAAABOOXAXIKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJZG4ZTGNZVHA . You are receiving this because you commented.Message ID: @.***>
v2.56.14 Partial Result. Only this works (a bit):
$ tpl
?- op(1,xfx,&).
true.
?- op(1,fy,&). % this first
true.
?- op(1,yf,&). % then this, otherwise non-functional
true.
?- [user]. &(x). &(x,x). end_of_file.
true.
?- X& .
X = x.
?- (X&),true. % brackets additionally required
X = x.
?- &X,(Y&),X&Y.
X = x, Y = x.
?- (Y&),&X,X&Y.
Y = x, X = x.
?-
Hmm, you're right. But it's daft to have an operator be both prefix & postfix.
On Thu, Sep 19, 2024 at 6:37 PM flexoron @.***> wrote:
v2.56.14 Partial Result. Only this works (a bit):
$ tpl ?- op(1,xfx,&). true. ?- op(1,fy,&). % this first true. ?- op(1,yf,&). % then this, otherwise non-functional true. ?- [user]. &(x). &(x,x). end_of_file. true. ?- X& . X = x. ?- (X&),true. % brackets additionally required X = x. ?- &X,(Y&),X&Y. X = x, Y = x. ?- (Y&),&X,X&Y. Y = x, X = x. ?-
— Reply to this email directly, view it on GitHub https://github.com/trealla-prolog/trealla/issues/596#issuecomment-2360370914, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNKSEWN3Y7W46CXY6WXRWLZXKELNAVCNFSM6AAAAABOOXAXIKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRQGM3TAOJRGQ . You are receiving this because you commented.Message ID: @.***>
But not too bad. At least eclipse,swipl approached. A question might be: listing. &x or x& or both
?- op(1,xfx,&).
true.
?- op(1,fy,&).
true.
?- op(1,yf,&).
true.
?- [user]. &(x). &(x,x). end_of_file.
true.
?- listing.
&x.
x&x.
true.
?- halt.
$ tpl
?- op(1,xfx,&).
true.
?- op(1,yf,&).
true.
?- op(1,fy,&).
true.
?- [user]. &(x). &(x,x). end_of_file.
true.
?- listing.
x&.
x&x.
true.
?-
Left in tpl's 'issue' basket: Scryer and the others don't care about the order ...
$ scryer-prolog -f
?- op(1,yf,&).
true.
?- op(1,fy,&).
true.
?- [user].
&x.
x& .
?- &X.
X = x
; X = x.
?- X& .
X = x
; X = x.
?-
%% ... and don't need brackets %%
?- X&,&X,true.
X = x
; X = x
; X = x
; X = x.
?- &X,X&,true.
X = x
; X = x
; X = x
; X = x.
?-
I think you should define the prefix op before defining it as postfix, it's the natural order of things ;-)
Ah this explains why C-Programmers are supranatural extraterrestrials. for(complex i=∞i;;i++)i--;-)
v2.56.12