vencinachev Oct 25th, 2019 129 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- type Student = (String, Int)
- s1 :: Student
- s2 :: Student
- s1 = ("Ivan Petrov", 111213)
- s2 = ("Hristo Hristov", 102030)
- mult4 :: (Int, Int, Int, Int) -> Int
- mult4 (x, y, z, t) = x*y*z*t
- sort2 :: (Int, Int) -> (Int, Int)
- sort2 (x, y) = if x >= y then (x, y) else (y, x)
- fib :: Int -> Int
- fib n
- | n == 1 = 1
- | n == 2 = 1
- | n > 2 = fib (n-2) + fib (n-1)
- | otherwise = error "Not defined"
- fibStep :: (Int, Int) -> (Int, Int)
- fibStep (u, v) = (u, u+v)
- fibPair :: Int -> (Int, Int)
- fibPair n = (fib(n), fib(n + 1))
- toEnd :: a -> [a] -> [a]
- toEnd x l = l ++ [x]
- sumPairs :: [(Int, Int)] -> [Int]
- sumPairs pL = [x + y | (x, y) <- pL]
- digit :: Char -> Bool
- digit ch = ch >= '0' && ch <= '9'
- all_digits :: String -> String
- all_digits str = [ch | ch <- str, digit ch]
- allEven :: [Int] -> Bool
- allEven x = (x == [a | a <- x, even a])
- allOdd :: [Int] -> Bool
- allOdd x = (x == [a | a <- x, odd a])
- revWords :: String -> String
- revWords input = (unwords . reverse . words) input
- sumMy :: [Int] -> Int
- sumMy  = 0
- sumMy (x:xs) = x + sum xs
- concatMy :: [[a]] -> [a]
- concatMy  = 
- concatMy (x : xs) = x ++ concat xs
- calssify :: Int -> String
- classify age = case age of 0 -> "newborn"
- 1 -> "infant"
- 2 -> "toddler"
- _ -> "senior citizen"
- day :: Int -> String
- day x = case x of
- 1 -> "Monday"
- 2 -> "Tuesday"
- 3 -> "Wednesday"
- 4 -> "Thursday"
- 5 -> "Friday"
- 6 -> "Saturday"
- 7 -> "Sunday"
- _ -> "Not defined"
RAW Paste Data