abstractarray.jl docs confusion: “storagetype
might be a type or a function.” #37226
Closed
Description
opened on Aug 27, 2020
In the documentation for similar()
, the following is written:
Lines 711 to 715 in 1c9c241
What does it mean for storagetype
to be a function? I have tried to find a method for similar()
that accepts a function for its first argument, but to no avail:
julia> methods(similar, (Any, NTuple))
# 6 methods for generic function "similar":
[1] similar(a::Array{T,N} where N, dims::Tuple{Vararg{Int64,N}}) where {T, N} in Base at array.jl:381
[2] similar(B::BitArray, dims::Tuple{Vararg{Int64,N}} where N) in Base at bitarray.jl:370
[3] similar(S::SharedArrays.SharedArray, dims::Tuple{Vararg{Int64,N}} where N) in SharedArrays at /Users/Ron/Applications/Julia-1.5.app/Contents/Resources/julia/share/julia/stdlib/v1.5/SharedArrays/src/SharedArrays.jl:564
[4] similar(a::AbstractArray{T,N} where N, dims::Tuple) where T in Base at abstractarray.jl:630
[5] similar(::Type{T}, dims::Tuple{Vararg{Int64,N}} where N) where T<:AbstractArray in Base at abstractarray.jl:675
[6] similar(::Type{T}, shape::Tuple{Union{Integer, Base.OneTo},Vararg{Union{Integer, Base.OneTo},N} where N}) where T<:AbstractArray in Base at abstractarray.jl:674
julia> methods(similar, (Any, Vararg{AbstractRange,N} where N))
# 11 methods for generic function "similar":
[…] # methods with empty varargs elided
[4] similar(B::BitArray, dims::Int64...) in Base at bitarray.jl:369
[…]
[8] similar(A::Test.GenericArray, s::Integer...) in Test at /Users/Ron/Applications/Julia-1.5.app/Contents/Resources/julia/share/julia/stdlib/v1.5/Test/src/Test.jl:1654
[…]
[10] similar(a::AbstractArray{T,N} where N, dims::Union{Integer, AbstractUnitRange}...) where T in Base at abstractarray.jl:631
[11] similar(::Type{T}, dims::Union{Integer, AbstractUnitRange}...) where T<:AbstractArray in Base at abstractarray.jl:673
Metadata
Assignees
Labels
No labels
Activity