Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Haskell Language -- using the function all, return True iff all the elements in the list are nonzero. p9 :: [Integer] -> Bool p9 =

Haskell Language

-- 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 Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

define the term outplacement

Answered: 1 week ago

Question

describe the services that an outplacement consultancy may provide.

Answered: 1 week ago