Skip to content

Commit 5bc2a2a

Browse files
committed
Move count_nodes back to base.jl
1 parent 3677a02 commit 5bc2a2a

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/EquationUtils.jl

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,6 @@ import ..EquationModule:
1313
any,
1414
filter_map
1515

16-
"""
17-
count_nodes(tree::AbstractNode)::Int
18-
19-
Count the number of nodes in the tree.
20-
"""
21-
function count_nodes(tree::AbstractNode; break_sharing=Val(false))
22-
return tree_mapreduce(
23-
_ -> 1,
24-
+,
25-
tree,
26-
Int64;
27-
f_on_shared=(c, is_shared) -> is_shared ? 0 : c,
28-
break_sharing,
29-
)
30-
end
31-
3216
"""
3317
count_depth(tree::AbstractNode)::Int
3418

src/base.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,22 @@ end
220220
# Derived functions: ##########################################################
221221
###############################################################################
222222

223+
"""
224+
count_nodes(tree::AbstractNode)::Int
225+
226+
Count the number of nodes in the tree.
227+
"""
228+
function count_nodes(tree::AbstractNode; break_sharing=Val(false))
229+
return tree_mapreduce(
230+
_ -> 1,
231+
+,
232+
tree,
233+
Int64;
234+
f_on_shared=(c, is_shared) -> is_shared ? 0 : c,
235+
break_sharing,
236+
)
237+
end
238+
223239
"""
224240
foreach(f::Function, tree::AbstractNode)
225241

0 commit comments

Comments
 (0)