# \#collections

**URL:** https://discourse.julialang.org/tag/collections/1352.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Recommended idiom for collecting narrowest type](https://discourse.julialang.org/t/recommended-idiom-for-collecting-narrowest-type/136604)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 16\
**Last updated:** [April 10, 2026, 1:59am UTC](https://discourse.julialang.org/t/recommended-idiom-for-collecting-narrowest-type/136604 "2026-04-10T01:59:47Z")

</div>

Suppose I have a Vector with an abstract element type. What is the recommended idiom for collecting the elements into a vector with the narrowest possible element type? MWE: struct Foo{T} x::T end X = Foo\[Foo(1), Fo…

---

## [New package: Collects.jl - meant to improve upon and generalize the interface of collect](https://discourse.julialang.org/t/new-package-collects-jl-meant-to-improve-upon-and-generalize-the-interface-of-collect/129468)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 9\
**Last updated:** [February 17, 2026, 11:36pm UTC](https://discourse.julialang.org/t/new-package-collects-jl-meant-to-improve-upon-and-generalize-the-interface-of-collect/129468 "2026-02-17T23:36:31Z")

</div>

Just requested the registration of the new package, Collects.jl, meaning it should be registered after three days pass. Basically it’s meant to replace collect, especially when the desired output container type is not A…

---

## [Storing collections of heterogeneous data](https://discourse.julialang.org/t/storing-collections-of-heterogeneous-data/99159)

<div class="topic-metadata">

**Author:** [@bvanderbeek](https://discourse.julialang.org/u/bvanderbeek)\
**Replies:** 7\
**Last updated:** [May 20, 2023, 9:55pm UTC](https://discourse.julialang.org/t/storing-collections-of-heterogeneous-data/99159 "2023-05-20T21:55:38Z")

</div>

I’m writing some Julia code in which I need to loop over a collection of observations. The observations are not all of the same type and each type of observation is defined in a specific structure. I need to then perform…

---

## [Do blocks inner arguments](https://discourse.julialang.org/t/do-blocks-inner-arguments/98861)

<div class="topic-metadata">

**Author:** [@Mastomaki](https://discourse.julialang.org/u/Mastomaki)\
**Replies:** 1\
**Last updated:** [May 15, 2023, 6:50am UTC](https://discourse.julialang.org/t/do-blocks-inner-arguments/98861 "2023-05-15T06:50:06Z")

</div>

Hello! From the documentation https://docs.julialang.org/en/v1/base/collections/: get!(d, i) do i^2 end Should this not be get!(d, i) do i i^2 end ??
