What are the types of these functions?
triple x = 3 * x
even x = (x `mod` 2 == 0)
palindrome xs = (reverse xs == xs)
f x = f x
Write these functions (which are all built into the standard library):
a) isPrefixOf :: Eq a => [a] → [a] →
Bool
isInfixOf :: Eq a => [a] → [a] → Boolgroup :: Eq a => [a] → [[a]]group "Mississippi" == ["M","i","ss","i","ss","i","pp","i"]
Implelement the built-in function cycle
that takes a list L and returns an infinite list consisting of L
repeated over and over:
> take 10 (cycle "abc") "abcabcabca"
Write a function that transposes a matrix represented as a list of lists.
Construct an infinite list allPairs
that contains all pairs of positive integers. Every pair must appear
exactly once in the list.
Write a function that sorts a list of values using a mergesort. Give your function an appropriate type using a type class constraing.
Solve Project Euler's problem 14.