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

Did not get the expected value #24

Open
rookiefront opened this issue Jul 16, 2023 · 2 comments
Open

Did not get the expected value #24

rookiefront opened this issue Jul 16, 2023 · 2 comments

Comments

@rookiefront
Copy link

rookiefront commented Jul 16, 2023

const shuntingYard = new ShuntingYard();
var rpn = shuntingYard.parse([6, '+', 'sqrt', '(', 6, '+', 3, ')']);
// [6, '+', 6, 3, '+', 'sqrt']
var result = shuntingYard.resolveRpn(rpn);
// Error 
/*
vue.runtime.esm.js:1442 TypeError: Cannot read properties of undefined (reading 'apply')
    at ShuntingYard.resolveRpn (ShuntingYard.js?t=1689476073976:116:30)
*/


op.params is null

image

@Calamari
Copy link
Owner

Calamari commented Aug 9, 2023

Hey @rookiefront , sorry for the delayed response.
Question: did you define what "'sqrt' is ? I don't see that any shuntingYard.addOperator call in your code snippet above. Without that, the resolver will not know what to do with sqrt. How to use it is described in the README, but if you have questions, please feel free to follow up :)

@Calamari
Copy link
Owner

Calamari commented Aug 9, 2023

But I think a nicer error message might be a dev quality improvement :)

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