Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define Base.show for SArray and MArray. #1021

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tpapp
Copy link
Contributor

@tpapp tpapp commented Apr 24, 2022

This allows SArray and MArray to be printed (show, repr, etc) and read back into an object of the same type.

Fixes #692.

This allows SArray and MArray to be printed (show, repr, etc) and read
back into an object of the same type.

Fixes JuliaArrays#692.
@thchr
Copy link
Collaborator

thchr commented Apr 27, 2022

I'm not sure that it's preferable to print the content as a tuple though; e.g.,

A = @SMatrix [1 2; 3 4]

would now repr as SMatrix{2,2,Int}(1, 2, 3, 4). That seems OK for repr maybe, but it's not great for printing vectors of A. E.g., the default showing of [A, A, A] now becomes:

julia> [A, A, A]
3-element Vector{SMatrix{2, 2, Int64, 4}}:
 SMatrix{2,2,Int64}(1, 3, 2, 4)
 SMatrix{2,2,Int64}(1, 3, 2, 4)
 SMatrix{2,2,Int64}(1, 3, 2, 4)

How about instead printing this as SA{T}[...]?

@mcabbott
Copy link
Collaborator

mcabbott commented May 7, 2022

Xref #906 which has some discussion of what to print.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

repr roundtripping. "print it like you build it"
3 participants