
1 May
2008
1 May
'08
8:24 a.m.
Copy-paste approach's failed you. Hint: try removing acountL definition and compiling everything else.
-- count with tail calls for the left subtree acountL :: Tree -> Integer -> Integer acountL (Leaf _) acc = acc + 1 acountL (Branch t1 t2) acc = acountL t1 $! (acountL t2 acc)
-- count with tail calls for the right subtree acountR :: Tree -> Integer -> Integer acountR (Leaf _) acc = acc + 1 acountR (Branch t1 t2) acc = acountR t2 $! (acountL t1 acc)
Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe