I got… hmmm… let’s call interesting behavior with the comprehension but only in function:
function foo(tmax, a, b, M, N)
println("1: a=$a, b=$b, tmax = $tmax, M = $M, N = $N")
tpts = [ tmax/M*i for i in 0:N ]
println("2: a=$a, b=$b, tmax = $tmax, M = $M, N = $N")
xpts = [ a+(b-a)/N*j for j in 0:M ]
println("3: a=$a, b=$b, tmax = $tmax, M = $M, N = $N")
return (tpts, xpts)
end
And then:
(t1, x1) = foo(1.0, -1.0, 2.0, 10, 10);
produces
1: a=-1.0, b=2.0, tmax = 1.0, M = 10, N = 10
2: a=-1.0, b=0.0, tmax = 1.0, M = 10, N = 10
3: a=-1.0, b=0.0, tmax = 1.0, M = 10, N = 10
Coefficient b
got turned to zero after the first comprehension. (Julia 0.6.2 on Windows) Can anyone else confirm it?