Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate similar(f, …) in favor of just dispatching directly on f(…) #26733

Merged
merged 5 commits into from
Apr 13, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'master' into mb/deprecatesimilarf
  • Loading branch information
mbauman authored Apr 12, 2018
commit 4e04a9555803575aa1ca0eaca8af14212bf68933
6 changes: 5 additions & 1 deletion base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,11 @@ julia> unique(A, dims=3)
false false
```
"""
@generated function unique(A::AbstractArray{T,N}, dim::Int) where {T,N}
unique(A::AbstractArray; dims::Union{Colon,Integer} = :) = _unique_dims(A, dims)

_unique_dims(A::AbstractArray, dims::Colon) = invoke(unique, Tuple{Any}, A)

@generated function _unique_dims(A::AbstractArray{T,N}, dim::Integer) where {T,N}
quote
1 <= dim <= $N || return copy(A)
hashes = zeros(UInt, axes(A, dim))
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.