[Haskell-cafe] Possible Improvements

PR Stanley prstanley at ntlworld.com
Mon Dec 3 00:20:35 EST 2007

data Tree = Leaf Int | Node Tree Int Tree

occurs :: Int -> Tree -> Bool
occurs m (Leaf n) = m == n
occurs m (Node l n r) = m == n || occurs m l || occurs m r

It works but I'd like to know if it can be improved in any way.
Thanks, Paul

More information about the Haskell-Cafe mailing list