First things first:
julia> versioninfo()
Julia Version 0.5.2
Commit f4c6c9d (2017-05-06 16:34 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, broadwell)
I’m experiencing the following strange phenomenon. I will demonstrate it by providing a sequence of files and REPL outputs.
Step 1
some_file.jl
function plus_number(x)
return x+1
end
Step 2
julia > include(“some_file.jl”)
julia > [plus_number(i) for i = 1:5]
5-element Array{Int64,1}:
2
3
4
5
6
Step 3
include.jl
function plus_number(x)
return x+2
end
Step 4
julia > include(“some_file.jl”)
julia > [plus_number(i) for i = 1:5]
5-element Array{Int64,1}:
2
3
4
5
6
So, the same output is generated when using UnitRanges with a list comprehension and I re-include the file. This seems strange to me. collect
ing the UnitRange and using a for
loop fixes this.
Lastly, but not leastly:
julia> versioninfo()
Julia Version 0.5.2
Commit f4c6c9d (2017-05-06 16:34 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, broadwell)