Closed fivemoreminix closed 5 years ago
Seems that by design or flaw, depending on how you look at it, the parser does prefer functions over multiplying the two variables. For example:
>sqrt = 5
5
>sin sqrt (5)
0.786749131547214
>sin (5*5)
-0.13235175009777303
>sqrt 5
2.23606797749979
>sin ans
0.786749131547214
Since functions having a syntax like
func var1 (var2)
poses two problems:func
is too since it has an argument. But we were only multiplyingvar1
byvar2
! We need to find a way to determine this.We could potentially solve this by having the parser export potential discrepencies (identifier followed by parenthetical expressions) as
FunctionOrVariable
with its variable name and expression tree, which the computer can possibly index thevariables
andfunctions
maps to see if there is a function that matches, or if there is a variable, and select one of the two, probably preferring functions.Since as of posting this issue, computation time only accounts for about 500 ns of time out of the 7.5 microseconds of time the entire evaluation takes, implementing this in the computer should not be such a bad idea, or add much delay.