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

Pure left-to-right evaluation #35

Open
horaceho opened this issue Jan 28, 2013 · 6 comments
Open

Pure left-to-right evaluation #35

horaceho opened this issue Jan 28, 2013 · 6 comments

Comments

@horaceho
Copy link

How to make + − the same precedence as x ÷ ?

Such that 3+5x2=13 becomes 3+5x2=16

@davedelong
Copy link
Owner

Well, you could edit the code in _DDMathOperatorInfo.m to make the operators have the same precedence, but that would only get you half-way there. What you're really asking for is for things to be always evaluated left-to-right, regardless of precedence. That would require significant work. However, I recognize that when it comes to writing a calculator app, left-to-right evaluation often feels "more natural", so I'll see if I can get around to doing this.

@davedelong davedelong changed the title How to change + − x ÷ precedence? Pure left-to-right evaluation Sep 19, 2015
@davedelong
Copy link
Owner

This could be accomplished by writing a custom Expressionizer (the thing that turns GroupedTokens into Expressions).

@joshdistler
Copy link

I'm looking to be able to toggle precedence at runtime. Could you provide an example (or link) to how this would be done using a custom Expressionizer (in Objective-C)?

@joshdistler
Copy link

Hi Dave. Just wondering if you've gotten a chance to add this (to the Obj-C version)?

@joshdistler
Copy link

I've been evaluating the Swift (3) branch recently. Any movement on this there (I assume you're no longer updating Obj-C as actively)?

@joshdistler
Copy link

@davedelong Hey Dave. Getting back on my project and hoping this is still in the cards?

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

No branches or pull requests

3 participants