Can't parse "a # not b", but parses "a # (not b)" and prints it as "a # not b"
David Scherfgen via Maxima-discuss <[email protected]> Wed, 10 Jun 2026 07:53:24 +0200
| Newsgroups | gmane.comp.mathematics.maxima.general |
|---|---|
| Message-ID | <CAMTHLKjREE5cjWoQbxsJ0xxeeM7KX1=2jpe23X67zo5DXMhcmg@mail.gmail.com> |
Dear all, as Stavros noted in this bug report <https://sourceforge.net/p/maxima/bugs/4390/>, Maxima fails to parse this: a # not b Error: "Found LOGICAL expression where ALGEBRAIC expression expected" However, a # (not b) with parentheses parses perfectly, but is printed *without parentheses*. This means that Maxima cannot parse its own output. (The same for =.) *Proposed fix:* In nparse.lisp, change lpos and rpos for the = and # operators from $expr to $any. Also, increase the binding powers of <, <=, >= and > from 80 to 85. Note that this is in accordance with most programming languages, where <, <=, >= and > have a higher binding power than == and !=, for the exact same reason of being able to compare logical expressions. Maxima currently has them all the same. If we make this change, the following expressions will parse directly without requiring parentheses, building the exact same trees they already do: a # not b a = not b a = b = c (parses as (a = b) = c) a > b = c (parses as (a > b) = c) c = a > b (parses as c = (a > b), wouldn't parse with the original binding powers) Would this have any unintended side-effects? Best regards David Scherfgen _______________________________________________ Maxima-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/maxima-discuss