Skip to content

Commit

Permalink
Documenting the type promotion used by merge()
Browse files Browse the repository at this point in the history
Behaviour present since #8883.
  • Loading branch information
Pontus Stenetorp committed Nov 14, 2014
1 parent f3017ff commit 02e5b69
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion doc/stdlib/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,24 @@ Given a dictionary ``D``, the syntax ``D[x]`` returns the value of key ``x`` (if

.. function:: merge(collection, others...)

Construct a merged collection from the given collections.
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::

julia> a = Dict("foo" => 0.0, "bar" => 42.0)
Dict{ASCIIString,Float64} with 2 entries:
"bar" => 42.0
"foo" => 0.0

julia> b = Dict("フー" => 17, "バー" => 4711)
Dict{UTF8String,Int64} with 2 entries:
"バ… => 4711
"フ… => 17

julia> merge(a, b)
Dict{UTF8String,Float64} with 4 entries:
"bar" => 42.0
"バー… => 4711.0
"フー… => 17.0
"foo" => 0.0

.. function:: merge!(collection, others...)

Expand Down

0 comments on commit 02e5b69

Please sign in to comment.