-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
It took me some time to figure out why this didn't work
julia> using DynamicExpressions
lt(x::Float64, a::Float64, b::Float64) = a * x + b
unary_ops = (-, inv, exp)
binary_ops = (+, *)
ternary_ops = (lt,)
operators = OperatorEnum(1 => unary_ops, 2 => binary_ops, 3 => ternary_ops)
Node{Float64}(op=0x1, children=(Node{Float64}(val=1.0), Node{Float64}(val=2.0),Node{Float64}(val=3.0)))
ERROR: AssertionError: D2 <= max_degree(N)
Stacktrace:
[1] node_factory
@ ~/.julia/packages/DynamicExpressions/85cyI/src/Node.jl:409 [inlined]
[2] #_#69
@ ~/.julia/packages/DynamicExpressions/85cyI/src/Node.jl:362 [inlined]
[3] AbstractExpressionNode
@ ~/.julia/packages/DynamicExpressions/85cyI/src/Node.jl:347 [inlined]
[4] top-level scope
@ ~/SR playground/Q2.jl:7I don't think there are any examples where the D type parameter is set manually:
julia> Node{Float64,3}(op=0x1, children=(Node{Float64,3}(val=1.0), Node{Float64,3}(val=2.0),Node{Float64,3}(val=3.0)))
lt(1.0, 2.0, 3.0)
Metadata
Metadata
Assignees
Labels
No labels