# Re-including file doesn't overwrite function within array comprehension

**URL:** <https://discourse.julialang.org/t/re-including-file-doesnt-overwrite-function-within-array-comprehension/3687>\
**Category:** General Usage\
**Created:** [May 13, 2017, 2:52am UTC](https://discourse.julialang.org/t/re-including-file-doesnt-overwrite-function-within-array-comprehension/3687 "2017-05-13T02:52:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fuzzybear3965](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fuzzybear3965/32/1049_2.png) [@fuzzybear3965](https://discourse.julialang.org/u/fuzzybear3965)\
**Post date:** [May 13, 2017, 2:52am UTC](https://discourse.julialang.org/t/re-including-file-doesnt-overwrite-function-within-array-comprehension/3687/1 "2017-05-13T02:52:03Z")

</div>

First things first:

```julia
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

```julia
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

```julia
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-auto
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)

```

---

<div class="post-metadata">

**Author:** ![fuzzybear3965](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fuzzybear3965/32/1049_2.png) [@fuzzybear3965](https://discourse.julialang.org/u/fuzzybear3965)\
**Post date:** [May 13, 2017, 3:09am UTC](https://discourse.julialang.org/t/re-including-file-doesnt-overwrite-function-within-array-comprehension/3687/2 "2017-05-13T03:09:44Z")

</div>

I should have investigated this more. Thanks @ChrisRackauckas for the link to the issue. It was a bug.

[https://github.com/JuliaLang/julia/issues/265](https://github.com/JuliaLang/julia/issues/265)
