Parser rejects operators as plain atoms in term position (require quoting) #19
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-prolog#19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The parser rejects operators (
+ - * < = mod…) when they appear as plain atoms in argument or list position. Standard Prolog (e.g. SWI) reads an operator in these positions as the corresponding atom; patch-prolog requires it to be quoted.Repro
It affects symbolic and word operators alike.
This is reader-only
The atom itself is fine everywhere else —
=..produces it and round-trips:So the gap is purely in how the reader handles an operator token in term position, not in the term representation.
Expected
Per ISO 6.3.1.3 / common practice, an operator name used as an atom (in an arglist, list, or via
=) should read as that atom:[+, -, *]is a 3-element list of atoms,X = (+)bindsXto+.Impact
Blocks the natural way to teach "operators are just compound terms" /
=..without quoting, and anyone arriving from SWI will trip on it. Workable around by quoting ('+'), which is what I've done in the loglings exercises.Found while building the
loglingsProlog exercises against the installed engine.#24