22 Feb
2007
22 Feb
'07
12:02 p.m.
Hi Chad,
I think this idea is better than what I had suggested, but as it stands it doesn't typecheck. Did you mean something like this?
Yep, just the type signature was wrong :)
leaves :: Tree -> [Int] leaves = f [] where f rest (Leaf n) = n : rest f rest (Branch l r) = f (f rest r) l
Thanks Neil