Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module TreeToList (Tree (Empty, Node), toList) where
- data Tree a = Empty | Node a (Tree a) (Tree a) deriving (Show)
- toList :: Tree a -> [a]
- toList Empty = []
- toList (Node a left right) = (toList left) ++ a : toList right
Advertisement
Add Comment
Please, Sign In to add comment