Skip to content
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

Add support for postfix operators (required for the factorial operator) #2

Open
alecrios opened this issue Jan 4, 2020 · 1 comment

Comments

@alecrios
Copy link
Owner

alecrios commented Jan 4, 2020

@jozsefsallai Turns out I missed a big issue with the factorial operator, so I reverted that bit while keeping the factorial() method.

The issue is that ! is a postfix operator. At the moment, we only support prefix and infix operators, so we would need to make special modifications to the convert() function in src/index.ts.

Your 2 + 4! test did pass, although, try running 4! + 2 and see how things break down.

If you're willing to look into how to add postfix support to the convert() function, that would be appreciated. I'll be looking into it as well, though maybe not immediately.

@jozsefsallai
Copy link
Contributor

Yeah, I figured there would be issues with that at some point. I saw that it worked with infix, so I went with that because I couldn't find anything for postfix operators. Can't believe I missed trying stuff like 4! + 2 🤦‍♂ Will try to look into this in my free time! Thanks for the merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants