Skip to content

Allow stack on empty collection #55735

@jariji

Description

@jariji
julia> stack(Vector{Int}[[], [], []]; dims=1)
3×0 Matrix{Int64}

julia> stack(Vector{Int}[[], []]; dims=1)
2×0 Matrix{Int64}

julia> stack(Vector{Int}[[]]; dims=1)
1×0 Matrix{Int64}

julia> stack(Vector{Int}[]; dims=1)
ERROR: LoadError: ArgumentError: `stack` on an empty collection is not allowed

Following the pattern it seems like that last one can be a 0x0 Matrix{Int64}. Supporting the empty case can be helpful for generic programming.

cc @mcabbott @LilithHafner for stack-related work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]collectionsData structures holding multiple items, e.g. sets

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions