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