Closed Moelf closed 1 year ago
Good point, it does seem a bit hacky. It's actually calling eval_tree_array(tree, X, operators)
. But when you define an OperatorEnum
with define_helper_functions=true
(default), it creates a definition for (tree::Node)(X::AbstractArray{T})
based on the OperatorEnum
.
However it's probably unsafe to emphasize this API. A better one would just be:
(tree::Node)(X::AbstractArray{T}, operators::OperatorEnum)
which means you would never have an instance of using the wrong operators
with a given tree (since the tree is just an enum - if you update the operators, it will change the definition of the tree!).
(The variable name operators
does not matter, by the way - calling OperatorEnum()
is what sets up the default behavior of the evaluation methods, if you're using this convenience API)
in all the examples we define a variable
operators
but don't use it explicitly, can we document it or make an explicit API?