Skip to content

Commit

Permalink
custom printing
Browse files Browse the repository at this point in the history
  • Loading branch information
ogauthe committed Oct 29, 2024
1 parent 3dcdd20 commit a184141
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ struct GradedOneTo{T,BlockLasts<:Vector{T}} <: AbstractGradedUnitRange{T,BlockLa
end
end

function Base.show(io::IO, mimetype::MIME"text/plain", g::AbstractGradedUnitRange)
v = blocklabels(g) .=> Int.(blocklengths(g))
println(typeof(g))
return show(io, mimetype, v)
end

# == is just a range comparison that ignores labels. Need dedicated function to check equality.
struct NoLabel end
blocklabels(r::AbstractUnitRange) = Fill(NoLabel(), blocklength(r))
Expand Down

0 comments on commit a184141

Please sign in to comment.