# Is there an interface to concatenate Dicts(or Set, OrderedDict etc.)?

**URL:** <https://discourse.julialang.org/t/is-there-an-interface-to-concatenate-dicts-or-set-ordereddict-etc/84577>\
**Category:** New to Julia\
**Tags:** question, data\_structures\
**Created:** [July 21, 2022, 5:37am UTC](https://discourse.julialang.org/t/is-there-an-interface-to-concatenate-dicts-or-set-ordereddict-etc/84577 "2022-07-21T05:37:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![acsofie](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/acsofie/32/36983_2.png) [@acsofie](https://discourse.julialang.org/u/acsofie)\
**Post date:** [July 21, 2022, 5:37am UTC](https://discourse.julialang.org/t/is-there-an-interface-to-concatenate-dicts-or-set-ordereddict-etc/84577/1 "2022-07-21T05:37:56Z")

</div>

A Vector usually been concatenated by `append!` or `vcat`. But there don’t work on Dict(or Set, OrderedDict etc.). Of cause we can use for-loop to add each element into a new dict.

I want to know is there an interface like `append!` or `vcat` to concatenate. This should be reasonable.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [July 21, 2022, 5:45am UTC](https://discourse.julialang.org/t/is-there-an-interface-to-concatenate-dicts-or-set-ordereddict-etc/84577/2 "2022-07-21T05:45:56Z")

</div>

`union`

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [July 21, 2022, 5:48am UTC](https://discourse.julialang.org/t/is-there-an-interface-to-concatenate-dicts-or-set-ordereddict-etc/84577/3 "2022-07-21T05:48:54Z")

</div>

> ```julia
> help?> merge
> search: merge merge! mergewith mergewith! MergeSort
> 
> merge(d::AbstractDict, others::AbstractDict...)
> 
> Construct a merged collection from the given collections. If necessary, the types of the resulting collection will
> be promoted to accommodate the types of the merged collections. If the same key is present in another collection,
> the value for that key will be the value it has in the last collection listed. See also mergewith for custom
> handling of values with the same key.
> [...]
> 
> ```

---

<div class="post-metadata">

**Author:** ![acsofie](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/acsofie/32/36983_2.png) [@acsofie](https://discourse.julialang.org/u/acsofie)\
**Post date:** [July 21, 2022, 6:21am UTC](https://discourse.julialang.org/t/is-there-an-interface-to-concatenate-dicts-or-set-ordereddict-etc/84577/4 "2022-07-21T06:21:44Z")

</div>

nice answer

---

<div class="post-metadata">

**Author:** ![acsofie](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/acsofie/32/36983_2.png) [@acsofie](https://discourse.julialang.org/u/acsofie)\
**Post date:** [July 21, 2022, 6:22am UTC](https://discourse.julialang.org/t/is-there-an-interface-to-concatenate-dicts-or-set-ordereddict-etc/84577/5 "2022-07-21T06:22:14Z")

</div>

not I need, but another nice answer
