Skip to content

Commit

Permalink
Merge pull request #9002 from ninjin/nin/merge_doc
Browse files Browse the repository at this point in the history
RFC: Documenting the type promotion used by `merge()`
  • Loading branch information
StefanKarpinski committed Nov 14, 2014
2 parents 3340b2f + 02e5b69 commit b923a43
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 b923a43

Please sign in to comment.