# Weird behaviour when flattening generator expression with vcat

**URL:** <https://discourse.julialang.org/t/weird-behaviour-when-flattening-generator-expression-with-vcat/8382>\
**Category:** General Usage\
**Created:** [January 15, 2018, 12:57pm UTC](https://discourse.julialang.org/t/weird-behaviour-when-flattening-generator-expression-with-vcat/8382 "2018-01-15T12:57:42Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Paethon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paethon/32/9278_2.png) [@Paethon](https://discourse.julialang.org/u/Paethon)\
**Post date:** [January 16, 2018, 11:31am UTC](https://discourse.julialang.org/t/weird-behaviour-when-flattening-generator-expression-with-vcat/8382/10 "2018-01-16T11:31:14Z")

</div>

A very simple example showing this “problem”:

```julia
a = [1 , 2, 3]
g = (a[i] for i in 1:3)
a = [4, 5, 6]
collect(g)
# Gives 4, 5, 6
# Intuitively I would have expected it to give 1, 2, 3

```

But this is so fundamental that I would be very surprised if it wasn’t supposed to be like that?

---

_[View the full topic](https://discourse.julialang.org/t/weird-behaviour-when-flattening-generator-expression-with-vcat/8382)._
