@@ -11,30 +11,36 @@ copy!(dst::AbstractSet, src::AbstractSet) = union!(empty!(dst), src)
1111 union(s, itrs...)
1212 ∪(s, itrs...)
1313
14- Construct the union of sets. Maintain order with arrays .
14+ Construct an object containing all distinct elements from all of the arguments .
1515
16- See also: [`intersect`](@ref), [`isdisjoint`](@ref), [`vcat`](@ref), [`Iterators.flatten`](@ref).
16+ The first argument controls what kind of container is returned.
17+ If this is an array, it maintains the order in which elements first appear.
18+
19+ Unicode `∪` can be typed by writing `\\ cup` then pressing tab in the Julia REPL, and in many editors.
20+ This is an infix operator, allowing `s ∪ itr`.
21+
22+ See also [`unique`](@ref), [`intersect`](@ref), [`isdisjoint`](@ref), [`vcat`](@ref), [`Iterators.flatten`](@ref).
1723
1824# Examples
1925```jldoctest
20- julia> union([1, 2], [3, 4 ])
21- 4 -element Vector{Int64}:
26+ julia> union([1, 2], [3])
27+ 3 -element Vector{Int64}:
2228 1
2329 2
2430 3
25- 4
2631
27- julia> union([1, 2], [2, 4])
28- 3-element Vector{Int64}:
29- 1
30- 2
31- 4
32+ julia> union([4 2 3 4 4], 1:3, 3.0)
33+ 4-element Vector{Float64}:
34+ 4.0
35+ 2.0
36+ 3.0
37+ 1.0
3238
33- julia> union([4, 2], 1:2 )
34- 3-element Vector{Int64 }:
35- 4
36- 2
37- 1
39+ julia> (0, 0.0) ∪ (-0.0, NaN )
40+ 3-element Vector{Real }:
41+ 0
42+ -0.0
43+ NaN
3844
3945julia> union(Set([1, 2]), 2:3)
4046Set{Int64} with 3 elements:
@@ -53,14 +59,14 @@ const ∪ = union
5359"""
5460 union!(s::Union{AbstractSet,AbstractVector}, itrs...)
5561
56- Construct the union of passed in sets and overwrite `s` with the result.
62+ Construct the [` union`](@ref) of passed in sets and overwrite `s` with the result.
5763Maintain order with arrays.
5864
5965# Examples
6066```jldoctest
61- julia> a = Set([1, 3, 4, 5]);
67+ julia> a = Set([3, 4, 5]);
6268
63- julia> union!(a, 1:2:8 );
69+ julia> union!(a, 1:2:7 );
6470
6571julia> a
6672Set{Int64} with 5 elements:
@@ -102,10 +108,15 @@ end
102108 intersect(s, itrs...)
103109 ∩(s, itrs...)
104110
105- Construct the intersection of sets.
106- Maintain order with arrays.
111+ Construct the set containing those elements which appear in all of the arguments.
112+
113+ The first argument controls what kind of container is returned.
114+ If this is an array, it maintains the order in which elements first appear.
107115
108- See also: [`setdiff`](@ref), [`isdisjoint`](@ref), [`issubset`](@ref Base.issubset), [`issetequal`](@ref).
116+ Unicode `∩` can be typed by writing `\\ cap` then pressing tab in the Julia REPL, and in many editors.
117+ This is an infix operator, allowing `s ∩ itr`.
118+
119+ See also [`setdiff`](@ref), [`isdisjoint`](@ref), [`issubset`](@ref Base.issubset), [`issetequal`](@ref).
109120
110121!!! compat "Julia 1.8"
111122 As of Julia 1.8 intersect returns a result with the eltype of the
@@ -117,14 +128,21 @@ julia> intersect([1, 2, 3], [3, 4, 5])
1171281-element Vector{Int64}:
118129 3
119130
120- julia> intersect([1, 4, 4, 5, 6], [4, 6 , 6, 7, 8])
131+ julia> intersect([1, 4, 4, 5, 6], [6, 4 , 6, 7, 8])
1211322-element Vector{Int64}:
122133 4
123134 6
124135
125- julia> intersect(Set([1, 2]), BitSet([2, 3]))
126- Set{Int64} with 1 element:
127- 2
136+ julia> intersect(1:16, 7:99)
137+ 7:16
138+
139+ julia> (0, 0.0) ∩ (-0.0, 0)
140+ 1-element Vector{Real}:
141+ 0
142+
143+ julia> intersect(Set([1, 2]), BitSet([2, 3]), 1.0:10.0)
144+ Set{Float64} with 1 element:
145+ 2.0
128146```
129147"""
130148function intersect (s:: AbstractSet , itr, itrs... )
0 commit comments