Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Julia type hierachy as an example for creating a tree #20

Closed
s-celles opened this issue Aug 21, 2018 · 2 comments · May be fixed by #32
Closed

Julia type hierachy as an example for creating a tree #20

s-celles opened this issue Aug 21, 2018 · 2 comments · May be fixed by #32

Comments

@s-celles
Copy link
Member

Hello,

Following JuliaLang/julia#24741 (comment)
maybe AbstractTrees could provide an example to get a tree of type hierarchy.

Kind regards

@FedeClaudi
Copy link
Contributor

A bit late to the party here, but Term now provides functionality very much like the one discussed above, see [here]: https://fedeclaudi.github.io/Term.jl/stable/ren/tree/#TypeTree

image

@s-celles
Copy link
Member Author

s-celles commented May 1, 2022

As suggested by @karlwessel in JuliaLang/julia#24741 (comment)

julia> AbstractTrees.children(x::Type) = subtypes(x)

julia> print_tree(Number)
Number
├─ Complex
└─ Real
   ├─ AbstractFloat
   │  ├─ BigFloat
   │  ├─ Float16
   │  ├─ Float32
   │  └─ Float64
   ├─ AbstractIrrational
   │  └─ Irrational
   ├─ Integer
   │  ├─ Bool
   │  ├─ Signed
   │  │  ├─ BigInt
   │  │  ├─ Int128
   │  │  ├─ Int16
   │  │  ├─ Int32
   │  │  ├─ Int64
   │  │  └─ Int8
   │  └─ Unsigned
   │     ├─ UInt128
   │     ├─ UInt16
   │     ├─ UInt32
   │     ├─ UInt64
   │     └─ UInt8
   └─ Rational

@s-celles s-celles closed this as completed May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants