Parametric polymorphism: Difference between revisions
Content added Content deleted
Line 769: | Line 769: | ||
""" |
""" |
||
function map!(f::Function, bt::Tree{T}) where T |
function map!(f::Function, bt::Tree{T}) where T |
||
bt.val= f(bt.val) |
bt.val = f(bt.val) |
||
print(" (" * string(bt.val)) # Demo only |
print(" (" * string(bt.val)) # Demo only |
||
bt.lchild !== nothing && map!(f, bt.lchild) |
bt.lchild !== nothing && map!(f, bt.lchild) |