-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
non-recursive SameQ[] #1077
non-recursive SameQ[] #1077
Conversation
@mmatera The idea is interesting and needed. I'd like look over this in more detail over the weekend and think about it. Thanks! |
mathics/doc/latex/mathics-title.pdf
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mmatera Something in "make clean" is removing this. I haven't found where or fixed this.
Also it would be nice if we had a way to automatically generate ths.
c9a8f62
to
16f2eda
Compare
@mmatera looked the code over and do not find anything wrong with it. I made some small changes to the docstring comment and addressed some of the lint errors my editor is telling me about. We can't use generators here since there we access and then "rewind" sometimes. And this _is_ essentially a version without the tail recursions. So I've removed the comments concerning doubt. If you have the example that caused the failure on 3.12 without this change, it would be interesting to benchmark just this test inside a Mathics3 session to see if there's any difference in execution time. Other comments I'll put in the specific code changes in this PR. --------- Co-authored-by: Juan Mauricio Matera <[email protected]>
LGTM - merge when you are ready. |
This PR is a proposal for a reimplementation of
Expression.sameQ
which uses a tree transversal iterative algorithm instead of recursion. Using this implementation, we avoid the recursion issue in the Pytests for Python 3.12.I leave this as a draft for a while, in case someone else wants to propose a better solution.