September 2017
Beginner to intermediate
396 pages
9h 46m
English
data BinaryTree a = Leaf | BinaryTree { left :: BinaryTree a , val :: a , right :: BinaryTree a } deriving Show
empty :: BinaryTree a empty = Leaf singleton :: a -> BinaryTree a singleton x = BinaryTree Leaf x Leaf node :: BinaryTree a -> a -> BinaryTree a -> BinaryTree a node l x r = BinaryTree { left = l, val = x, right = r }
dfTraverse :: BinaryTree a -> [a] dfTraverse Leaf = [] dfTraverse tree ...
Read now
Unlock full access