Skip to content

Commit

Permalink
Merge pull request JuliaLang#20800 from JuliaLang/nl/unique
Browse files Browse the repository at this point in the history
Improve docstrings for unique()
  • Loading branch information
nalimilan committed Jun 14, 2017
2 parents 6facbe3 + 486ee7a commit 9fdc6d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 7 additions & 4 deletions base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1294,11 +1294,14 @@ end
hash(x::Prehashed) = x.hash

"""
unique(itr[, dim])
unique(A::AbstractArray[, dim::Int])
Return an array containing only the unique elements of `A`, as determined by
[`isequal`](@ref), in the order that the first of each set of equivalent elements
originally appears.
If `dim` is specified, return unique regions of `A` along dimension `dim`.
Returns an array containing only the unique elements of the iterable `itr`, in
the order that the first of each set of equivalent elements originally appears.
If `dim` is specified, returns unique regions of the array `itr` along `dim`.
```jldoctest
julia> A = map(isodd, reshape(collect(1:8), (2,2,2)))
Expand Down
5 changes: 3 additions & 2 deletions base/set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ const ⊆ = issubset
"""
unique(itr)
Returns an array containing one value from `itr` for each unique value,
as determined by [`isequal`](@ref).
Return an array containing only the unique elements of collection `itr`,
as determined by [`isequal`](@ref), in the order that the first of each
set of equivalent elements originally appears.
```jldoctest
julia> unique([1; 2; 2; 6])
Expand Down

0 comments on commit 9fdc6d1

Please sign in to comment.