Hello everyone.
I’ve found this weird behaviour when using StaticArrays within a begin … end block Pluto.
I have this cell
begin
xᵢ = collect(range(0, 10, length=n)) |> SVector{n}
yᵢ = @SVector [β₀ + β₁ * i + rand() for i in xᵢ]
end
where β₀ and β₁ are just normal floats, and n
is an int. The problem is that, when I run the code like this it wont work! It returns me a UndefVarError: xᵢ not defined in Main.var"workspace#3"
. If I run the variable declaration for xᵢ and yᵢ separetely, that is, in different cells, everything works fine. It is only when they are together.
Does anyone knows what might be going on?
My versioninfo()
and ]status
. Pluto version=v0.20.8.
julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin24.0.0)
CPU: 10 × Apple M4
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 4 default, 0 interactive, 2 GC (on 4 virtual cores)
Environment:
JULIA_REVISE_WORKER_ONLY = 1
julia> import Pkg; Pkg.status()
Status `/private/var/folders/05/16l0_s8d0g3680ryypw6qw7r0000gn/T/jl_IBJiAk/Project.toml`
[6e4b80f9] BenchmarkTools v1.6.0
[31c24e10] Distributions v0.25.120
[38e38edf] GLM v1.9.0
⌃ [91a5bcdd] Plots v1.40.13
[90137ffa] StaticArrays v1.9.13
[10745b16] Statistics v1.11.1
[f3b207a7] StatsPlots v0.15.7
[9d95f2ec] TypedTables v1.4.6
[44cfe95a] Pkg v1.11.0
[9a3f8284] Random v1.11.0
Info Packages marked with ⌃ have new versions available and may be upgradable.