Closed flexoron closed 1 month ago
?- op(1,xfy,&). op(1,fy,&). op(1,yf,&).
?- [user]. &(x). &(x,x). end_of_file.
?- [user]. (&x&)&x. end_of_file.
Warning: overwriting '&'/2
?- &(&(&(x)),x) = (& (&x))&x. % fixed
true.
?- (& (&x))&x.
true.
?- listing.
&x.
(& &x)&x.
?- &x.
true.
?- (& &x)&x.
Segmentation fault (core dumped)
No longer crashes but a syntax error (incorrect):
$ tpl
?- op(1,xfy,&), op(1,fy,&), op(1,yf,&).
true.
?- [user]. &(x). &(x,x). end_of_file.
true.
?- [user]. (&x&)&x. end_of_file.
Warning: overwriting '&'/2
true.
?- (&(&x))&x.
true.
?- (& &x)&x.
Error: syntax error, missing operand to postfix, user:1
?-
Odd since there is no postfix involved in parsing the query.
Question: Do you think it's correct to overwrite other 'facts' in case of an error?
op(1,xfy,&), op(1,fy,&), op(1,yf,&).
[user]. &(x). &(x,x). end_of_file.
[user]. (&x&)&x. end_of_file.
[user]. (&x&)&y. end_of_file.
?- listing.
&x.
(& &x)&y.
?- [user]. (& &z)&y. end_of_file.
Error: syntax error, missing operand to postfix, user:1
Warning: overwriting '&'/1 % A Term Split ???
true.
?- listing.
&y. % Unexpected
(& &x)&y.
true.
?-
v2.56.17
?- op(1,xfy,&), op(1,fy,&), op(1,yf,&).
?- [user]. (& &z)&y. end_of_file.
?- listing.
(& &z)&y.
true.
?- [user]. (&&z)&y. end_of_file.
Error: syntax error, near 'z', operator expected, user:1
Error: syntax error, start of rule expected, user:1
true.
?- listing.
(& &z)&y.
&y. % Unexpected
true.
?- [user].
(&&z)&y.
Error: syntax error, near 'z', operator expected, user:1
true.
?- listing.
true. % Gone
?-
v2.56.14