Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. f :: [[(a,[b])]] -> Int
  2. f [(x,xs):[y,ys]]            = 0
  3. f ([_]:[(x,[xs])]:[y,ys]:[]) = 1
  4. f ([(x,y:_:[])]:[])          = 2
  5.  
  6. x0 :: [[(Bool, [Int])]]
  7. x0 = [[(True,[2,4,6]),(True,[2,4,6]),(True,[2,4,6])]]
  8.  
  9. x1 :: [[(Char,[Int])]]
  10. x1 = [[('a',[2])],  [('B',[2])],  [('a',[3]), ('D',[4])]]
  11.  
  12. x2 :: [[(Int, String)]]
  13. x2 = [[(1, "ab")]]
  14.  
  15.  
  16. letterize :: String -> [String]
  17. letterize [] = []
  18. letterize asd = [head asd]:letterize(tail asd)
  19.  
  20. swapElems :: [[a]] -> [[a]]
  21. swapElems [] = []
  22. swapElems ([x]:xs) = ([x]: swapElems xs)
  23. swapElems ((st:nd:ys):xs) = ((nd:st:ys) : swapElems xs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement