JuliaSymbolics / JuliaSymbolics/TermInterface.jl
request for new functions: `isvariable` and `variablename`
- Dominant language
- Julia
- Stars
- 41
- Forks
- 6
- Avg merge
- 1d 22m
- Merged PRs (30d)
- 1
Description
I want to be able to convert any TermInterface.jl expression to one of the expression types defined by my [CallableExpressions.jl](https://gitlab.com/nsajko/CallableExpressions.jl) package. However, I don't think that TermInterface.jl on its own currently makes that possible. The problem is that, for leaves of the expression tree, I'm not able to:
* tell variables apart from constants
* convert a *foreign* variable type to a *native* variable type, for that I need to associate the variable with a name, as each variable is determined by a single `Symbol` value in CallableExpressions.jl
I think it'd make sense for TermInterface.jl to introduce two additional functions:
* `isvariable` (name subject to bikeshedding, of course): `isvariable(x)` should be `true` when `x` is a single variable, and it should be `false` when `x` is a constant or an expression (neither constant expressions nor variable expressions count as "a variable" here)
* `variablename(x)` should return an object representing a unique name for the variable, ideally convertible to `Symbol`
Thoughts?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.