PaddiM8 / kalker

Scientific calculator with math syntax that supports user-defined variables and functions, complex numbers, and estimation of derivatives and integrals
https://kalker.xyz
MIT License
1.59k stars 70 forks source link

Is there any way to retrieve variables from `Context`? #99

Open NatanFreeman opened 1 year ago

NatanFreeman commented 1 year ago

I would like to retrieve all user defined variables from a Context but this doesn't seem like it's currently possible. Being able to delete them would be useful too.

PaddiM8 commented 1 year ago

It is not currently possible, but would make sense to implement. Hmm... the symboltable of variables doesn't map variable names to numerical values, but to expressions. I'm trying to figure out what would make sense to return. I'm assuming your use-case involves using the actual numerical values connected with the variables?

NatanFreeman commented 1 year ago

I would like to be able to retrieve an iterator of variable names along with their values. Being able to delete variables from this list would also be useful. The alternative is creating a new Context and repopulating it but this is less efficient.