-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
I'm learning Julia and thought it would be great to see the type hierarchy easily. The subtypes function is great but it only shows one level. So I created a simple function that prints the entire subtree. Would it be good to add to Base?
julia> function subtypetree(t, level=1, indent=4)
level == 1 && println(t)
for s in subtypes(t)
println(join(fill(" ", level * indent)) * string(s))
subtypetree(s, level+1, indent)
end
end
subtypetree (generic function with 3 methods)
julia> subtypetree(Number)
Number
Complex
Real
AbstractFloat
BigFloat
Float16
Float32
Float64
Integer
BigInt
Bool
Signed
Int128
Int16
Int32
Int64
Int8
Unsigned
UInt128
UInt16
UInt32
UInt64
UInt8
Irrational
Rationalnalimilan, jishnub, s-celles, singularitti, chkwon and 16 more
Metadata
Metadata
Assignees
Labels
No labels