Pluto.jl: One-dimensional arrays lose relevant info in display

Created on 20 Sep 2020  路  8Comments  路  Source: fonsp/Pluto.jl

In the REPL:

julia> using OffsetArrays

julia> kernel = OffsetArray([0.2, 1, 0.3], -1:1)
3-element OffsetArray(::Vector{Float64}, -1:1) with eltype Float64 with indices -1:1:
 0.2
 1.0
 0.3

In Pluto:
image

which doesn't reveal that the first element is accessed as kernel[-1].

Most helpful comment

New behaviour:

image

All 8 comments

It also seems odd to me that ranges are displayed as lists.

In this case, you will see the indices when you click, but I agree that we should differentiate between different AbstractArrays, also in the unexpanded form. Any ideas?

Maybe we can write it in the current form when it is an Array{T,1}, and write it as:

OffsetArray(::Vector{Float64}, -1:1)([0.2, 1.0, 0.3])

for other types?

How is the display done? For 2d arrays it seems to use the normal display machinery, but 1d seems different.

1D abstractarrays, dicts, structs and some others use our custom display system, which is an interactive tree viewer.

New behaviour:

image

I also added a : between the type and the array for AbstractArrays that are not Arrays, like the OffsetArray, to differentiate an offsetarray from an Array of offsetarrays :)

Oh, that's very sweet! Thanks so much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

briochemc picture briochemc  路  6Comments

dpsanders picture dpsanders  路  6Comments

briochemc picture briochemc  路  5Comments

MikaelSlevinsky picture MikaelSlevinsky  路  7Comments

karlwessel picture karlwessel  路  4Comments