Skip to content

Commit b923a43

Browse files
Merge pull request #9002 from ninjin/nin/merge_doc
RFC: Documenting the type promotion used by `merge()`
2 parents 3340b2f + 02e5b69 commit b923a43

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

doc/stdlib/base.rst

+18-1
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,24 @@ Given a dictionary ``D``, the syntax ``D[x]`` returns the value of key ``x`` (if
10621062

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

1065-
Construct a merged collection from the given collections.
1065+
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::
1066+
1067+
julia> a = Dict("foo" => 0.0, "bar" => 42.0)
1068+
Dict{ASCIIString,Float64} with 2 entries:
1069+
"bar" => 42.0
1070+
"foo" => 0.0
1071+
1072+
julia> b = Dict("フー" => 17, "バー" => 4711)
1073+
Dict{UTF8String,Int64} with 2 entries:
1074+
"バ… => 4711
1075+
"フ… => 17
1076+
1077+
julia> merge(a, b)
1078+
Dict{UTF8String,Float64} with 4 entries:
1079+
"bar" => 42.0
1080+
"バー… => 4711.0
1081+
"フー… => 17.0
1082+
"foo" => 0.0
10661083

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

0 commit comments

Comments
 (0)