How to differentiate between variables and functions #2657
-
I want to extract all the variables from a formula. I am traversing through the Expression Tree using the The problem is that the functions like Is there any way I can ignore all those values? Right now I am doing the following to differentiate them:
The I want to do this so that I can ask the user for those values and then set the scope using the user input to evaluate the formula. Is there any better way to handle this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Good question. An expression with a function like |
Beta Was this translation helpful? Give feedback.
-
@tannakartikey |
Beta Was this translation helpful? Give feedback.
Good question. An expression with a function like
sin(2)
is parsed into aFunctionNode
with a property.fn
containing aSymbolNode
with namesin
. To check whether aSymbolNode
is the name of a function, you can check whether it's parent is aFunctionNode
or not.