nicer display, share more code
This commit is contained in:
parent
ce6c96c2be
commit
7505ee3a16
@ -11,12 +11,6 @@ Batch(xs) = Batch(Storage(xs))
|
|||||||
convert{T,S}(::Type{Batch{T,S}},storage::S) =
|
convert{T,S}(::Type{Batch{T,S}},storage::S) =
|
||||||
Batch{T,S}(storage)
|
Batch{T,S}(storage)
|
||||||
|
|
||||||
@render Juno.Inline b::Batch begin
|
|
||||||
Tree(Row(Text("Batch of "), eltype(b),
|
|
||||||
Juno.fade("[$(length(b))]")),
|
|
||||||
Juno.trim(collect(b)))
|
|
||||||
end
|
|
||||||
|
|
||||||
# TODO: figure out how to express this as a generic convert
|
# TODO: figure out how to express this as a generic convert
|
||||||
function rebatch(xs)
|
function rebatch(xs)
|
||||||
dims = ndims(xs)-1
|
dims = ndims(xs)-1
|
||||||
@ -48,12 +42,6 @@ Seq(xs) = Seq(Storage(xs))
|
|||||||
convert{T,S}(::Type{Seq{T,S}},storage::S) =
|
convert{T,S}(::Type{Seq{T,S}},storage::S) =
|
||||||
Seq{T,S}(storage)
|
Seq{T,S}(storage)
|
||||||
|
|
||||||
@render Juno.Inline b::Seq begin
|
|
||||||
Tree(Row(Text("Seq of "), eltype(b),
|
|
||||||
Juno.fade("[$(length(b))]")),
|
|
||||||
Juno.trim(collect(b)))
|
|
||||||
end
|
|
||||||
|
|
||||||
BatchSeq{T<:Seq} = Batch{T}
|
BatchSeq{T<:Seq} = Batch{T}
|
||||||
|
|
||||||
function rebatchseq(xs)
|
function rebatchseq(xs)
|
||||||
|
@ -46,8 +46,12 @@ function Storage(xs)
|
|||||||
Storage{eltype(xs)}(xs)
|
Storage{eltype(xs)}(xs)
|
||||||
end
|
end
|
||||||
|
|
||||||
@render Juno.Inline b::Storage begin
|
typename(b::Type) = b
|
||||||
Tree(Row(Text("Storage of "), eltype(b),
|
typename(b::Type{<:BatchLike}) =
|
||||||
|
Row(Juno.typ("$(b.name.name)"), text"{", typename(eltype(b)), text"}")
|
||||||
|
|
||||||
|
@render Juno.Inline b::BatchLike begin
|
||||||
|
Tree(Row(typename(typeof(b)),
|
||||||
Juno.fade("[$(length(b))]")),
|
Juno.fade("[$(length(b))]")),
|
||||||
Juno.trim(collect(b)))
|
Juno.trim(collect(b)))
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user