Skip to content

Commit bd2878f

Browse files
rfourquetararslan
authored andcommitted
uniquify the docstring of unique(itr) (#22368)
1 parent 414841a commit bd2878f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

base/multidimensional.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,14 +1294,11 @@ end
12941294
hash(x::Prehashed) = x.hash
12951295

12961296
"""
1297-
unique(A::AbstractArray[, dim::Int])
1297+
unique(A::AbstractArray, dim::Int)
12981298
1299-
Return an array containing only the unique elements of `A`, as determined by
1300-
[`isequal`](@ref), in the order that the first of each set of equivalent elements
1301-
originally appears.
1302-
1303-
If `dim` is specified, return unique regions of `A` along dimension `dim`.
1299+
Return unique regions of `A` along dimension `dim`.
13041300
1301+
# Examples
13051302
13061303
```jldoctest
13071304
julia> A = map(isodd, reshape(collect(1:8), (2,2,2)))

base/set.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,10 @@ Return an array containing only the unique elements of collection `itr`,
127127
as determined by [`isequal`](@ref), in the order that the first of each
128128
set of equivalent elements originally appears.
129129
130+
# Example
131+
130132
```jldoctest
131-
julia> unique([1; 2; 2; 6])
133+
julia> unique([1, 2, 6, 2])
132134
3-element Array{Int64,1}:
133135
1
134136
2
@@ -182,8 +184,10 @@ end
182184
Returns an array containing one value from `itr` for each unique value produced by `f`
183185
applied to elements of `itr`.
184186
187+
# Example
188+
185189
```jldoctest
186-
julia> unique(isodd, [1; 2; 2; 6])
190+
julia> unique(isodd, [1, 2, 6, 2])
187191
2-element Array{Int64,1}:
188192
1
189193
2

0 commit comments

Comments
 (0)