From 888adbcb9eb0da0d12c771af29dcb854b5ed0e6d Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Thu, 25 May 2017 09:54:22 +0200 Subject: [PATCH] document AbstractArray and doctest for Array (#22052) --- base/abstractarray.jl | 7 +++++++ base/array.jl | 14 +++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index 92236060a78fb..2ac43912a6960 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -2,6 +2,13 @@ ## Basic functions ## +""" + AbstractArray{T, N} + +Abstract array supertype which arrays inherit from. +""" +AbstractArray + """ size(A::AbstractArray, [dim...]) diff --git a/base/array.jl b/base/array.jl index c6b4c24da7ef5..3677f92717a9a 100644 --- a/base/array.jl +++ b/base/array.jl @@ -53,10 +53,22 @@ import Core: arraysize, arrayset, arrayref Array{T,N}(dims) Construct an uninitialized `N`-dimensional dense array with element type `T`, -where `N` is determined from the length or number of `dims`. `dims` may +where `N` is determined from the length or number of `dims`. `dims` may be a tuple or a series of integer arguments corresponding to the lengths in each dimension. If the rank `N` is supplied explicitly as in `Array{T,N}(dims)`, then it must match the length or number of `dims`. + +# Example + +```jldoctest +julia> A = Array{Float64, 2}(2, 2); + +julia> ndims(A) +2 + +julia> eltype(A) +Float64 +``` """ Array