-
-
Save neomatrixcode/04d3c310d82bd2e40e8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requested gist of code to produce: | |
# https://www.scribd.com/doc/271871142/Julia-Type-Hierarchy | |
# | |
# I just redirected the output to a dot file, then executed: | |
# dot -Tpdf julia.dot -o julia.pdf | |
function print_type_tree(t, parent=Any, seen=Set{DataType}()) | |
# Avoid redundant edges. | |
t ∈ seen && return | |
push!(seen, t) | |
# Avoid self-edges. | |
t != Any && println(""" "$t" -> "$parent";""") | |
# Recurse, divine! | |
for s in subtypes(t) | |
print_type_tree(s, t, seen) | |
end | |
end | |
println("digraph {") | |
print_type_tree(Any) | |
println("}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment