Skip to content

Commit 23ce949

Browse files
committed
Remove unused functions
1 parent 40d3c1d commit 23ce949

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/DynamicExpressions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import Reexport: @reexport
2424
set_node!,
2525
tree_mapreduce,
2626
filter_map
27-
import .EquationModule: constructorof, with_type_parameters, preserve_sharing
27+
import .EquationModule: constructorof, preserve_sharing
2828
@reexport import .EquationUtilsModule:
2929
count_nodes,
3030
count_constants,

src/Equation.jl

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ abstract type AbstractNode end
2727
AbstractExpressionNode{T} <: AbstractNode
2828
2929
Abstract type for nodes that represent an expression.
30-
This additionally must have fields for:
30+
Along with the fields required for `AbstractNode`,
31+
this additionally must have fields for:
3132
3233
- `constant::Bool`: Whether the node is a constant.
3334
- `val::T`: Value of the node. If `degree==0`, and `constant==true`,
@@ -103,6 +104,25 @@ end
103104
Exactly the same as `Node{T}`, but with the assumption that some
104105
nodes will be shared. All copies of this graph-like structure will
105106
be performed with this assumption, to preserve structure of the graph.
107+
For example:
108+
109+
```julia
110+
julia> operators = OperatorEnum(;
111+
binary_operators=[+, -, *], unary_operators=[cos, sin]
112+
);
113+
114+
julia> x = GraphNode(feature=1)
115+
x1
116+
117+
julia> y = sin(x) + x
118+
sin(x1) + {x1}
119+
120+
julia> cos(y) * y
121+
cos(sin(x1) + {x1}) * {(sin(x1) + {x1})}
122+
```
123+
124+
Note how the `{}` indicates a node is shared, and this
125+
is the same node as seen earlier in the string.
106126
"""
107127
mutable struct GraphNode{T} <: AbstractExpressionNode{T}
108128
degree::UInt8 # 0 for constant/variable, 1 for cos/sin, 2 for +/* etc.
@@ -131,12 +151,6 @@ constructorof(::Type{N}) where {N<:AbstractNode} = Base.typename(N).wrapper
131151
constructorof(::Type{<:Node}) = Node
132152
constructorof(::Type{<:GraphNode}) = GraphNode
133153

134-
function with_type_parameters(::Type{N}, ::Type{T}) where {N<:AbstractExpressionNode,T}
135-
return constructorof(N){T}
136-
end
137-
with_type_parameters(::Type{<:Node}, ::Type{T}) where {T} = Node{T}
138-
with_type_parameters(::Type{<:GraphNode}, ::Type{T}) where {T} = GraphNode{T}
139-
140154
"""Trait declaring whether nodes share children or not."""
141155
preserve_sharing(::Type{<:AbstractNode}) = false
142156
preserve_sharing(::Type{<:Node}) = false

0 commit comments

Comments
 (0)