Closed mwageringel closed 5 years ago
Commit: 51dadd7
Author: Markus Wageringel
Branch: u/gh-mwageringel/28439
I suggest testing this in the terminal, as in the Jupyter notebook there does not seem to be a way to exit the subshells.
The remaining pyflakes warning is a false positive.
Branch pushed to git repo; I updated commit sha1. New commits:
760de84 | 28439: handle parsing of nested parentheses |
I have fixed another problem, see the description.
Description changed:
---
+++
@@ -2,6 +2,7 @@
- whitespace is incorrectly stripped from the front of the output string
- special characters are not properly escaped
+- the syntax `sage(...)` for evaluating expressions in Sage does not support nested parentheses
The whitespace issues are particular frequent with interfaces that use ASCII art for printing like Mathematica and Macaulay2:
@@ -36,3 +37,14 @@
I changed the Gap interface to preserve whitespace at the front in order to be able to add a doctest for interact
using a standard interface.
+
+As for the nested parentheses, the following example now works. The expressions sage(...)
are evaluated in Sage and converted to Gap.
+
+```
+sage: %gap
+
+gap: 2 + sage((1+2)*gap(-(5-3)^2).sage()) - sage(1+(2-1)) +-12 +```
Rebased to fix an incorrect trac link in the first commit spotted by the patchbot.
Description changed:
---
+++
@@ -4,7 +4,9 @@
- special characters are not properly escaped
- the syntax `sage(...)` for evaluating expressions in Sage does not support nested parentheses
-The whitespace issues are particular frequent with interfaces that use ASCII art for printing like Mathematica and Macaulay2:
+---
+
+The whitespace issues are particularly frequent with interfaces that use ASCII art for printing like Mathematica and Macaulay2:
sage: macaulay2.interact() @@ -38,7 +40,7 @@
I changed the Gap interface to preserve whitespace at the front in order to be able to add a doctest for interact
using a standard interface.
-As for the nested parentheses, the following example now works. The expressions sage(...)
are evaluated in Sage and converted to Gap.
+As for the nested parentheses, the following example now works. The expressions sage(...)
are evaluated in Sage and the results are converted to Gap. Previously, this only worked for very simple expressions not containing any parenthesis.
sage: %gap
Reviewer: Travis Scrimshaw
All of these changes make sense and look good.
Thanks.
I kept noticing incorrect stripping of initial whitespace without ever doing anything about it.
Finally initial whitespace will be preserved. Wholehearted thanks for that!
Changed branch from u/gh-mwageringel/28439 to dc0d969
The function
Interface.interact()
gives interactive access to the interpreter session of a pexpect interface that is running in the background. This ticket fixes the following issues with the output:sage(...)
for evaluating expressions in Sage does not support nested parenthesesThe whitespace issues are particularly frequent with interfaces that use ASCII art for printing like Mathematica and Macaulay2:
An artificial example using a standard interface which shows whitespace and escaping issue:
With the usual
gap.eval()
the escaping is done correctly, but in the case of Gap, whitespace is still stripped from the front.I changed the Gap interface to preserve whitespace at the front in order to be able to add a doctest for
interact
using a standard interface.As for the nested parentheses, the following example now works. The expressions
sage(...)
are evaluated in Sage and the results are converted to Gap. Previously, this only worked for very simple expressions not containing any parenthesis.Component: interfaces
Keywords: macaulay2, gap
Author: Markus Wageringel
Branch/Commit:
dc0d969
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/28439