# Invalid redefinition of constant in comprehensions

**URL:** https://discourse.julialang.org/t/invalid-redefinition-of-constant-in-comprehensions/6252
**Category:** General Usage
**Created:** [October 4, 2017, 9:42pm UTC](https://discourse.julialang.org/t/invalid-redefinition-of-constant-in-comprehensions/6252 "2017-10-04T21:42:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)
#### Post date: [October 4, 2017, 9:42pm UTC](https://discourse.julialang.org/t/invalid-redefinition-of-constant-in-comprehensions/6252/1 "2017-10-04T21:42:02Z")

</div>

I am running the following code from the following section in Julia manual: [https://docs.julialang.org/en/latest/manual/arrays/#Comprehensions-1:](https://docs.julialang.org/en/latest/manual/arrays/#Comprehensions-1:)

```julia
x = rand(8)
[0.25*x[i-1] + 0.5*x[i] + 0.25*x[i+1] for i=2:length(x)-1 ]
Float32[0.25*x[i-1] + 0.5*x[i] + 0.25*x[i+1] for i=2:length(x)-1 ]

```

all works fine.  
Now I define a function:

```julia
s4() = 0

```

and running the above code fails. More specifically the last expression returns:

```julia
julia> Float32[0.25*x[i-1] + 0.5*x[i] + 0.25*x[i+1] for i=2:length(x)-1 ]
ERROR: invalid redefinition of constant #s4
Stacktrace:
 [1] anonymous at .\<missing>:?

```

More specifically the following error happens when:

- function of name `s1`, `s2`, `s3` or `s4` is defined;
- a type is prepended to the comprehension.

Is it a bug or I am missing someting trivial?

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [October 4, 2017, 11:03pm UTC](https://discourse.julialang.org/t/invalid-redefinition-of-constant-in-comprehensions/6252/2 "2017-10-04T23:03:24Z")

</div>

It’s another funny bug similar to [https://github.com/JuliaLang/julia/issues/23809](https://github.com/JuliaLang/julia/issues/23809)
