Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. data Bintree a = Empty | Fork a (Bintree a) (Bintree a) deriving Show
  2.  
  3. foldBtree :: val -> (a -> val -> val -> val) -> Bintree a -> val
  4. foldBtree val _ Empty = val
  5. foldBtree val f (Fork a left right) = f a (foldBtree val f left) (foldBtree val f right)
  6.  
  7. or_ :: Tree Bool -> Bool
  8. or_ = foldTree id (||) False (||)
  9.  
  10. preorderB :: Bintree a -> [a]
  11. preorderB = foldBtree [] (a : [] ++) -- here is the problem, please help for this function and i must use foldBtree to get this. THanks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement