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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to