vakho

Haskell - 12.12.13 (Sakontrolosi)

Dec 12th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data Notebook = Reminder String Int Int | Tel String Int | Meeting Int Int Int String deriving(Eq, Show)
  2.  
  3. getMyDate :: Int -> Int -> [Notebook] -> [String]
  4. getMyDate a b [] = []
  5. getMyDate a b ((Reminder name c d):xs) =    if (a==c && b==d) then name:(getMyDate a b xs)
  6.                         else (getMyDate a b xs)
  7. getMyDate a b (x:xs) = getMyDate a b xs
  8. -----------------------
  9.  
  10. mySum xs = foldr (+) 0 xs
  11. myAnd xs = foldr (&&) True xs
  12. -----------------------
  13. data Tree a = Node a [Tree a]
  14.  
  15. levelList :: Int -> Tree a -> [a]
  16. levelList num (Node b []) =     if (num == 1) then [b]
  17.                 else []
  18. levelList num (Node b (x:xs)) = if (num == 1) then [b]
  19.                 else (levelList (num-1) x) ++ (levelList num (Node b xs))
  20. -----------------------
  21. myDelete :: Char -> String -> String
  22. myDelete chr str = filter (\x -> x /= chr) str
Advertisement
Add Comment
Please, Sign In to add comment