How to hand-craft an edge into a Pluto's a computational graph?

I think Pluto’s graph follows assignments, not necessarily modifications.

### A Pluto.jl notebook ###
# v0.19.36

using Markdown
using InteractiveUtils

# ╔═╡ 371228e6-afce-11ee-0e08-ffcab94f43bb
x = collect(1:10)

# ╔═╡ a0c5e59e-102b-4d04-a568-b19456a6d79a
n = 5

# ╔═╡ f59fac3f-6c9c-4b4e-87f6-44a80f036af0
y = if isodd(n)
    x[1:2:n] .= 42
    x
end

# ╔═╡ e75712ff-f50d-4f00-be5b-77408a49ece3
sum(y)

# ╔═╡ Cell order:
# ╠═371228e6-afce-11ee-0e08-ffcab94f43bb
# ╠═a0c5e59e-102b-4d04-a568-b19456a6d79a
# ╠═f59fac3f-6c9c-4b4e-87f6-44a80f036af0
# ╠═e75712ff-f50d-4f00-be5b-77408a49ece3

I don’t see how to add an assignment that catches reducing n yet.

Edit. ugh:

y = if isodd(n)
	y = copy(x)
	y[1:2:n] .= 42
	y
end
1 Like