# How can I do list comprehension for vcat?

**URL:** <https://discourse.julialang.org/t/how-can-i-do-list-comprehension-for-vcat/84178>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 13, 2022, 2:04pm UTC](https://discourse.julialang.org/t/how-can-i-do-list-comprehension-for-vcat/84178 "2022-07-13T14:04:24Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 14, 2022, 11:20am UTC](https://discourse.julialang.org/t/how-can-i-do-list-comprehension-for-vcat/84178/11 "2022-07-14T11:20:22Z")

</div>

> [@rocco\_sprmnt21](#):
>
> `@btime reduce(vcat, v, init=Int[]);`

For some reason, the `init` slows it down quite a bit:

```julia
julia> @btime reduce(vcat, $v, init=Int[]);
  23.151 μs (101 allocations: 210.23 KiB)

julia> @btime reduce(vcat, $v);
  962.444 ns (2 allocations: 5.12 KiB)

```

There is a related open issue for `mapreduce` ([#31137](https://github.com/JuliaLang/julia/issues/31137)) — it seems like we didn’t optimize a sufficiently low-level method of `reduce`.

---

_[View the full topic](https://discourse.julialang.org/t/how-can-i-do-list-comprehension-for-vcat/84178)._
