# Inference upon mapreduce

**URL:** <https://discourse.julialang.org/t/inference-upon-mapreduce/14673>\
**Category:** General Usage\
**Tags:** inference\
**Created:** [September 7, 2018, 5:10pm UTC](https://discourse.julialang.org/t/inference-upon-mapreduce/14673 "2018-09-07T17:10:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gpapo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gpapo/32/1857_2.png) [@gpapo](https://discourse.julialang.org/u/gpapo)\
**Post date:** [September 7, 2018, 5:10pm UTC](https://discourse.julialang.org/t/inference-upon-mapreduce/14673/1 "2018-09-07T17:10:35Z")

</div>

Just by curiosity, I was asking myself if the incapability of the compiler to make type-stabile this function

```julia
function _trykeepnames(dicts)
    ktype = mapreduce(keytype, promote_type, dicts)
    vtype = mapreduce(valtype, promote_type, dicts)
    d1 = first(dicts)
    return all(==(d1), dicts) ? OrderedDict{ktype, vtype}(d1) : OrderedDict{ktype, vtype}(defaultnamesdict(length(d1)))
end

```

is a matter of not having implemented yet a specialized `mapreduce(::typeof(typeof), ::typeof(promote_type), ...)` or there is an’intrinsic problem in doing such a thing.

---

<div class="post-metadata">

**Author:** ![gpapo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gpapo/32/1857_2.png) [@gpapo](https://discourse.julialang.org/u/gpapo)\
**Post date:** [September 7, 2018, 5:19pm UTC](https://discourse.julialang.org/t/inference-upon-mapreduce/14673/2 "2018-09-07T17:19:11Z")

</div>

Ops, I was wrong, inference was ok, the problem was an inconsistent function 😅
