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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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   

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education