Skip to content

[BUG] Base.show for Array{<:AbstractExpr} does not have an array structure #92

Open
@kunzaatko

Description

@kunzaatko

Describe the bug
When showing an Array of subtypes of AbstractExpr as is done multiple times in the documentation, it shows the exprs
in a linear manner with too many line breaks.

julia> @satvariable(A[1:4,1:4], Bool)
4×4 Matrix{BoolExpr}:
 A_1_1
  A_1_2
  A_1_3
  A_1_4

 A_2_1
  A_2_2
  A_2_3
  A_2_4

 A_3_1
  A_3_2
  A_3_3
  A_3_4

 A_4_1
  A_4_2
  A_4_3
  A_4_4

What is the expected behavior?
A more similar printing to the one in for any other array.

julia> A = rand(4,4)
4×4 Matrix{Float64}:
 0.40644   0.28163   0.326487  0.718578
 0.20378   0.88277   0.263093  0.892266
 0.946375  0.318535  0.819182  0.677715
 0.151498  0.307452  0.527431  0.253082

This is caused by the Base.string function which adds \n after the expressions. Perhaps this should be overridden for simple one value expressions so that they do not add the line break. Another way would be to add a method specifically for Array{<:AbstractExpr} methods which would not use the Base.string method... This wouldn't be as elegant IMHO though.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions