prstanley: > Hi > 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.
You could probably get away with: data Tree = Leaf !Int | Node Tree !Int Tree but that's a minor issue. I don't see anything wrong this this code -- isn't that what you'd hope to write? -- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe