-
Notifications
You must be signed in to change notification settings - Fork 4
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
Update the logic of solve method #6
Conversation
- to get single variable value, e.g. 'pi', the new rpn is '1 pi *', rather than 'pi'.
I'm not sure what is the output if you just type
|
In the elegant rpn shell:
|
I just looked at the updated code. Very nice. It allows cleaner implementation of functions that don't return a value. |
- do not push and pop operators into calculating stack (should speed up a little bit) - add new sto function to store variable (temporarily in current Rpn instance) Clean up docstring.
I've updated this PR, resolved two issues:
The feature of supporting user-defined function in CLI is still pending, that is Please help to check it. |
I very much like this new structure. One worry I have is that I tend to dislike the use of getattr and hasattr methods, since they can sometimes lead to trouble -- imagine if a user-defined function shared the same name as a method of the Rpn class. But perhaps I am worrying too much :) |
Good suggestion, now I make a dictionary to keep all the stored ones, pretty much simpler and clearer. |
To correctly handle the case of operations does not have returns.