data Sex = Female | Male allPairs :: [(String, Sex)] -> [(String, String)] allPairs = undefined people :: [(String, Sex)] people = [("Jeff", Male), ("Britta", Female), ("Annie", Female), ("Troy", Male)] naturalsFrom :: Integer -> [Integer] naturalsFrom n = n : naturalsFrom (n + 1) naturals :: [Integer] naturals = naturalsFrom 0 -- naturals !! 2 filter' _ [] = [] filter' p (x : xs) = if p x then x : filter' p xs else filter' p xs -- Jak se bude chovat interpret jazyka Haskell pro vstup filter' (< 3) naturals? takeWhile' _ [] = [] takeWhile' p (x : xs) = if p x then x : takeWhile' p xs else [] -- Jak se bude chovat interpret jazyka Haskell pro vstup takeWhile' (< 3) naturals? addNumbers :: [String] -> [String] addNumbers = undefined integers :: [Integer] integers = undefined threeSum :: [(Integer, Integer, Integer)] threeSum = undefined sumFold :: Num a => [a] -> a sumFold = undefined productFold :: Num a => [a] -> a productFold = undefined orFold :: [Bool] -> Bool orFold = undefined lengthFold :: [a] -> Int lengthFold = undefined maximumFold :: Ord a => [a] -> a maximumFold = undefined -- foldr1 (\x s -> x + 10 * s) -- foldl1 (\s x -> 10 * s + x) concatFold :: [[a]] -> [a] concatFold = undefined listifyFold :: [a] -> [[a]] listifyFold = undefined nullFold :: [a] -> Bool nullFold = undefined composeFold :: [a -> a] -> a -> a composeFold = undefined idFold :: [a] -> [a] idFold = undefined mapFold :: (a -> b) -> [a] -> [b] mapFold = undefined headFold :: [a] -> a headFold = undefined lastFold :: [a] -> a lastFold = undefined maxminFold :: Ord a => [a] -> (a, a) maxminFold = undefined suffixFold :: [a] -> [[a]] suffixFold = undefined filterFold :: (a -> Bool) -> [a] -> [a] filterFold = undefined oddEvenFold :: [a] -> ([a], [a]) oddEvenFold = undefined takeWhileFold :: (a -> Bool) -> [a] -> [a] takeWhileFold = undefined dropWhileFold :: (a -> Bool) -> [a] -> [a] dropWhileFold = undefined