# Incomplete description of type vector of pairs

**URL:** https://discourse.julialang.org/t/incomplete-description-of-type-vector-of-pairs/82706
**Category:** General Usage
**Tags:** question, inference, type-of-pair
**Created:** [June 13, 2022, 9:13pm UTC](https://discourse.julialang.org/t/incomplete-description-of-type-vector-of-pairs/82706 "2022-06-13T21:13:56Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)
#### Post date: [June 15, 2022, 3:50pm UTC](https://discourse.julialang.org/t/incomplete-description-of-type-vector-of-pairs/82706/5 "2022-06-15T15:50:16Z")

</div>

not sure I have fully understood the argument on the functioning of collect in relation to the determination of the types of the elements making up the vector.  
I try to submit two other examples that if clarified I can allow myself to better understand how things are going.

functions derive [this discussion](https://discourse.julialang.org/t/defining-a-parameter-out-of-pairs-and-values/82701/9)

Here the compréhension completely determines the type of the components the dict

```julia
julia> [(p,pp...)=>pv(p,pp) for(p,pp) in Iterators.flatten([k.=>v for (k,v) in d1])]
7-element Vector{Pair{Tuple{Char, Int64, Int64}, Float64}}:
 ('p', 1, 2) => 2.5
 ('p', 1, 7) => 4.1
 ('p', 2, 3) => 7.4
 ('q', 1, 2) => 2.5
 ('q', 2, 3) => 7.4
 ('q', 2, 5) => 5.6
 ('q', 5, 2) => 3.2

```

here not

```julia
ulia> [ (person,pair...)=>pv(person,pair) for (person,pair) in
                               Iterators.product(Persons,Pairs)][:]
18-element Vector{Pair{Tuple{Char, Int64, Int64}}}:
 ('p', 1, 2) => 2.5
 ('q', 1, 2) => 2.5
 ('p', 1, 7) => 4.1
 ('q', 1, 7) => nothing
 ('p', 2, 3) => 7.4
 ('q', 2, 3) => 7.4
 ('p', 2, 5) => nothing
 ('q', 2, 5) => 5.6
 ('p', 3, 4) => nothing
 ('q', 3, 4) => nothing
 ('p', 3, 5) => nothing
 ('q', 3, 5) => nothing
 ('p', 4, 1) => nothing
 ('q', 4, 1) => nothing
 ('p', 4, 5) => nothing
 ('q', 4, 5) => nothing
 ('p', 5, 2) => nothing
 ('q', 5, 2) => 3.2

```

but if I define the dictionary by hand, I get

```julia
julia> Dict(
       ('p', 1, 2) => 2.5,
        ('q', 1, 2) => 2.5,
        ('p', 1, 7) => 4.1,
        ('q', 1, 7) => nothing,
        ('p', 2, 3) => 7.4,
        )
Dict{Tuple{Char, Int64, Int64}, Union{Nothing, Float64}} with 5 entries:
  ('p', 1, 7) => 4.1
  ('q', 1, 7) => nothing
  ('p', 2, 3) => 7.4
  ('p', 1, 2) => 2.5
  ('q', 1, 2) => 2.5

```

---

_[View the full topic](https://discourse.julialang.org/t/incomplete-description-of-type-vector-of-pairs/82706)._
