Skip to content

Functions as "Array Initializers"  #48624

@uniment

Description

@uniment

(Related Discourse discussion)

This would be nice:

x = Array{Float64}(m, n) do (i, j)
    i+j
end
x == Float64[i+j for i=1:m, j=1:n] # true

If #48404 is approved, then this will work by sending a CartesianIndex as an argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions