Quiz
What is the type of swap . swap
?
-
(a, b) -> (a, b)
-
(a, b) -> (b, a)
-
a -> a
What is the type of \f g x -> (f x, g x)
?
-
(a -> b) -> (c -> d) -> (a,c) -> (b, d)
-
(a -> b) -> (a -> c) -> a -> (b, c)
-
(a -> b) -> (b -> a) -> a -> (b, a)
What is the type of \t -> (fst . fst $ t, (snd . fst $ t, snd t))
?
-
(a, (b, c)) -> (a, (b, c))
-
(a, (b, c)) -> ((a, b), c)
-
((a, b), c) -> (a, (b, c))
What does the function foldr (\x xs -> xs ++ [x]) []
do?
- It doesn’t change its input list at all
- It changes the associativity of a list from left to right
- It reverses its input list
What does the function foldr (\(x, y) zs -> x : y : zs) []
do?
- It turns a list of pairs into a pair of lists
- It turns a pair of lists into a list of pairs
- It turns a list of pairs into a list of elements
What is the type of foldr (\n b -> n == 3 && b)
?
-
(Foldable t, Eq a, Num a) => Bool -> t a -> Bool
-
(Foldable t, Eq a, Num a, Bool b) => b -> t a -> b
-
(Foldable t, Eq a, Num a) => Bool -> [ a ] -> Bool
What is the type of \x -> case x of (True, "Foo") -> show True ++ "Foo"
?
-
Either Bool String -> String
-
(Bool, String) -> String
-
Show a => (Bool, String) -> a
You have reached the end of this section!
You can check your current points from the blue blob in the bottom-right corner of the page.