Fun question! The “official” answer to the question in the title is: create variables! Pluto only tracks assignments and references, so that’s the mechanism you need to use to tell Pluto about extra edges.
The example from abraemer will work, also when n
is even.
x = collect(1:10)
n = 3
begin
modification_done = nothing
if isodd(n)
x[1:2:n] .= 37
end
end
begin
# reference this variable to create the reactive edge
modification_done
sum(x)
end
But I think that a solution that uses copy
like contradict suggested is probably better, as this eliminates any surprises when working on one of the intermediate cells.