e3 should default to e*3 like 3e does to 3 * e#61
e3 should default to e*3 like 3e does to 3 * e#61BKTB888 wants to merge 2 commits intonotKamui:mainfrom
Conversation
|
Hello @BKTB888, thanks for your contribution. I'm gonna take a look at it. However, do know that I have been having difficulties with maven for quite a bit and haven't had the time to investigate a lot, so your contribution might not see the light of the publication in a while. With that being said, the reason e3 was not expanded to e*3 automatically was that e3 has the shape of an identifier. I am not too sure about allowing such behavior. With that fact in mind, what do you think ? Have you tested that it doesn't clash with identifiers (say, you add a new function or constant |
|
I have run the basic tests and written some new ones, I haven't tested this particular behaviour, but I think it will work as follows: If e3 exists as an identifier, it will be interpreted as such. Else it will be tokenized as e, 3 and that allows the normalizeTokens function to assume multiplication |
|
This doesn't answer the question and issue conceptually. I am very much not sure considering e3 as anything other that an identifier is a good idea, even if e3 is not defined, also because it's not a conventional way to write 3e |
|
I found it useful while writing a calculator app because, I dont expect an error when i write e3 if I didn’t get an error with 3e. So i think there is a usecase here. And if i write something like elog2(something), the current code would also cause an exception. This would break it down into e*log2, unless there is such an id already, again I would expect this because 3log2 does the same. But I will write more tests to make sure everything works as I think it does. |
Hi this is my first contribution to an open-source project so I am not sure I did everything right.
I noticed that there was an inconsistency as the title says with constants, so I fixed it. I hope you agree and like the solution.