haskell language -- with the help of the function "even", return those elements of the given input list that are even p7 :: [Integer] -> [Integer] p7 = undefined -- return the number of zero values in the input list (you can use the section (== 0) as a predicate to test for 0) p8 :: [Integer] -> Int p8 = undefined
haskell language
-- with the help of the function "even", return those elements of the given input list that are even
p7 :: [Integer] -> [Integer]
p7 = undefined
-- return the number of zero values in the input list (you can use the section (== 0) as a predicate to test for 0)
p8 :: [Integer] -> Int
p8 = undefined
-- using the function all, return True iff all the elements in the list are nonzero.
p9 :: [Integer] -> Bool
p9 = undefined
{- given f , p , and xs, return the list of those elements x of xs
for which f x satisfies the given predicate p. -}
p10 :: (a -> b) -> (b -> Bool) -> [a] -> [a]
p10 = undefined
{- given a function and a list of inputs, construct the list of input-output pairs
for that function on those inputs. Hint: this is a good place to use an anonymous
function, to go from a value of type a to a value of type (a,b). -}
p11 :: (a -> b) -> [a] -> [(a,b)]
p11 = undefined
-- Multiply all the numbers in the input list
p12 :: [Integer] -> Integer
p12 = undefined
{- given an element x and a non-empty list of lists l, return a new list of lists
which is just like l except that it has an additional element at the
head, namely x:h, where h is the head of l.
So p13 x (y:ys) should equal (x:y):y:ys (in fact, that pretty much shows you
the code you should write). -}
p13 :: a -> [[a]] -> [[a]]
p13 = undefined
{- Using foldr and p13, construct the list of all sublists of the given
input list. So for [1,2,3], you would construct [[1,2,3],[2,3],[3],[]] -}
p14 :: [a] -> [[a]]
p14 = undefined
{- Add corresponding numbers in the two lists, dropping any excess.
So p15 [1,2,3] [10,20,30,40] should return [11,22,33]
Hint: use zipWith -}
p15 :: Num a => [a] -> [a] -> [a]
p15 = undefined
{- compose corresponding functions from the two lists,
creating a list of the resulting compositions. If one
list is longer, drop the excess.
Hint: again, use zipWith -}
p16 :: [b -> c] -> [a -> b] -> [a -> c]
p16 = undefined
Step by step
Solved in 2 steps