Advertisement
Guest User

haskell

a guest
Oct 17th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module A where
  2.  
  3. a :: Int -> Int
  4. a 0 = 0
  5. a n = x where
  6.   x :: Int
  7.   x = n + 3
  8.  
  9.   y :: Int
  10.   y = x+1
  11.  
  12. sublist :: Int -> Int -> [a] -> [a]
  13. sublist from to ls = take size (drop from ls)
  14.     where size = to - from + 1
  15.    
  16. index :: Int -> Int -> [[a]] -> a
  17. index i j mx = mx !! i !! j
  18.  
  19. concat :: [[a]] - [a]
  20. concat [] = []
  21. concat (x:ls) = x ++ concat ls
  22.  
  23. splice :: Int -> [a] -> [[a]]
  24. splice _ [] = []
  25. splice n ls = take n ls: splice n (drop n ls)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement