Skip to content

Commit 4a4ccf6

Browse files
committed
Update summary.jl
use a reference instead of a vector of one value for `max_id`
1 parent 8a3d760 commit 4a4ccf6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/compute_MTG/summary.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ list_nodes(mtg) = traverse(mtg, node -> node_id(node), type=Int)
125125
Returns the maximum id of the mtg
126126
"""
127127
function max_id(mtg)
128-
maxid = [0]
128+
maxid = Ref(0)
129129

130130
function update_maxname(id, maxid)
131-
id > maxid[1] ? maxid[1] = id : nothing
131+
id > maxid[] ? maxid[] = id : nothing
132132
end
133133

134134
traverse!(get_root(mtg), x -> update_maxname(node_id(x), maxid))
135135

136-
return maxid[1]
136+
return maxid[]
137137
end

0 commit comments

Comments
 (0)