Does the constant field of a Node only come into play for leaf nodes?
It seems nondeterministic for branch nodes when playing around with it in the REPL.
julia> using DynamicExpressions
operators = OperatorEnum(1 => (inv,), 2 => (+,))
t1 = Node{Float64}(feature=1) + Node{Float64}(feature=2)
t1.constant
false
julia> using DynamicExpressions
operators = OperatorEnum(1 => (inv,), 2 => (+,))
t1 = Node{Float64}(feature=1) + Node{Float64}(feature=2)
t1.constant
false
julia> t2 = Node{Float64}(op=0x1, children=(Node{Float64}(feature=1), Node{Float64}(feature=2)))
t2.constant
true
julia> using DynamicExpressions
operators = OperatorEnum(1 => (inv,), 2 => (+,))
t1 = Node{Float64}(feature=1) + Node{Float64}(feature=2)
t1.constant
false
julia> t2 = Node{Float64}(op=0x1, children=(Node{Float64}(feature=1), Node{Float64}(feature=2)))
t2.constant
false
Is the correct deterministic way for determining if a node is operator/constant/feature, to use has_operators and then has_constants?
Does the
constantfield of aNodeonly come into play for leaf nodes?It seems nondeterministic for branch nodes when playing around with it in the REPL.
Is the correct deterministic way for determining if a node is operator/constant/feature, to use
has_operatorsand thenhas_constants?