better printing

This commit is contained in:
Mike J Innes 2018-11-14 23:53:30 +00:00
parent 325035cf60
commit 6ac5345339
2 changed files with 7 additions and 1 deletions

View File

@ -53,6 +53,11 @@ end
Base.print_array(io::IO, x::TrackedArray) = Base.print_array(io, data(x))
function Base.show(io::IO, x::TrackedArray)
show(io, data(x))
print(io, " (tracked)")
end
Base.copy(x::TrackedArray) = x
Base.setindex!(xs::TrackedArray, v, i...) =

View File

@ -17,8 +17,9 @@ function back!(x::TrackedReal; once = true)
end
function Base.show(io::IO, x::TrackedReal)
T = get(io, :typeinfo, Any)
show(io, data(x))
print(io, " (tracked)")
T <: TrackedReal || print(io, " (tracked)")
end
Base.decompose(x::TrackedReal) = Base.decompose(data(x))