Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. --a csoport
  2.  
  3. --1 fel
  4. isDivs :: (Int, Int) -> Int -> Bool
  5. isDivs (a, b) x = mod a x == 0 || mod b x == 0
  6.  
  7. --2 fel
  8. numberedABC :: Char -> [(Int,Char)]
  9. numberedABC c = zip [1..] [myChar | myChar <- ['a' .. c]]
  10.  
  11. --3 fel
  12. squareSum :: [Int] -> Int
  13. squareSum a = sum [i*i | i <- a]
  14.  
  15. --4 fel
  16. greatCoord :: (Int,Int) -> Bool
  17. greatCoord (x, y) = mod x 10 == 0 && x * 2 == y
  18.  
  19. --5 fel
  20. scholars :: [(String, String, Double)] -> Double -> [String]
  21. scholars list m = [ name ++ " - " ++ code | (name, code, i) <- list, i >= m]
  22.  
  23. --6 fel végtelen
  24. howMany :: [Char] -> Char -> Int
  25. howMany str c = length $ filter (== c) str
  26.  
  27. --7 fel
  28. leaveSeconds :: [Char] -> [Char]
  29. leaveSeconds [] = []
  30. leaveSeconds (x:[]) = x : []
  31. leaveSeconds (x:y:ys) = x : leaveSeconds ys
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement