Created
August 9, 2012 13:24
-
-
Save toivoh/3304162 to your computer and use it in GitHub Desktop.
recshow example/test
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
require("recshow.jl") | |
type T | |
x | |
y | |
end | |
type Unshowable; end | |
show(io::IO, x::Unshowable) = error("Tried to show Unshowable()") | |
recshowln(x) = (recshow(x); println()) | |
println("Simple and tree structured objects: just as show") | |
recshowln(1.55) | |
recshowln(155) | |
recshowln("abc") | |
recshowln(T(1,2)) | |
println("\nSelf-referential objects:") | |
t = T(1,1); t.y = t | |
recshowln(t) | |
s = Set(); add(s,s) | |
recshowln(s) | |
d = Dict(); d[1]=d | |
recshowln(d) | |
println("DAG structured object:") | |
t1 = T(1,1) | |
t2 = T(t1,t1) | |
recshowln(T(t2,t2)) | |
println("Exception during show recording ==> partial printout:") | |
recshowln(T(t2, Unshowable())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: