From 92bc663a1d3ce01bb84d2fb31b6bae736d2498a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogumi=C5=82=20Kami=C5=84ski?= Date: Thu, 7 Apr 2022 11:15:46 +0200 Subject: [PATCH] change traverse to print_supertypes --- ch03.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ch03.jl b/ch03.jl index e4ba55c..6300e64 100644 --- a/ch03.jl +++ b/ch03.jl @@ -13,12 +13,12 @@ typeof(sum) == Function supertype(typeof(sum)) -function traverse(T) +function print_supertypes(T) println(T) - T == Any || traverse(supertype(T)) + T == Any || print_supertypes(supertype(T)) return nothing end -traverse(Int64) +print_supertypes(Int64) function print_subtypes(T, indent_level=0) println(" " ^ indent_level, T) @@ -29,8 +29,8 @@ function print_subtypes(T, indent_level=0) end print_subtypes(Integer) -traverse(typeof([1.0, 2.0, 3.0])) -traverse(typeof(1:3)) +print_supertypes(typeof([1.0, 2.0, 3.0])) +print_supertypes(typeof(1:3)) AbstractVector