Skip to content

Added toString function to Expression#47

Open
ron99 wants to merge 7 commits intofasseg:masterfrom
ron99:toString
Open

Added toString function to Expression#47
ron99 wants to merge 7 commits intofasseg:masterfrom
ron99:toString

Conversation

@ron99
Copy link

@ron99 ron99 commented Aug 13, 2015

The function converts the Expression object back to the original string which he was built from, without saving it.

The returned string is trimmed and built with specific rules when to use parenthesis, so it can be little different from the original expression string, but it will be formatted well.

I'm currently working on implicit multiplication option for the function (to use only when it's logical in the expression).

@fasseg
Copy link
Owner

fasseg commented Aug 14, 2015

@ron99: Thanks for you contribution. One question though: If you require this feature why not just save the original value in a String var in the Expression object?

@ron99
Copy link
Author

ron99 commented Aug 14, 2015

I built this function because I was building a derivative function for the expression (almost finish), and I wanted to see the result in a clear way, not thru a list of tokens.
This is also useful after the expression was going thru some optimization, and you want to see the result.

The expression is trimmed, formatted in a fixed structure and convert all implicit multiplication to regular multiplication, so it displayed in the most readable way.

@fasseg
Copy link
Owner

fasseg commented Nov 20, 2015

I have scheduled time to roll a new release next week, and will consider merging this into master.

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

Successfully merging this pull request may close these issues.

2 participants