Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a haskell function zeroes :: (Integer -> Integer) -> Integer->[Integer] such that zeroes f limit returns a list containing all of the integer zeroes

Write a haskell function zeroes :: (Integer -> Integer) -> Integer->[Integer] such that zeroes f limit returns a list containing all of the integer zeroes of the function f whose values are between 0 an dlimit inclusive.

image text in transcribed

5. In mathematical parlance, a zero of a function f is a value such that f(v) = 0, For example, the function g(x) = x + 7 has the value-7 as a zero (because g(-7) 0), the function h(x)2 -9 has both 3 and -3 as zeroes, and the function j(x+ 15 has no zeroes at all. Write a Haskell function zeroes (Integer -Integer) Integer > [Integer] such that zeroes f limit returns a list containing all of the integer ze- roes of the function f whose values are between O and limit, inclusive. (If limit is less than 0, then the function should return the empty list.) Here are some examples: Main> zeroes ( x->x*x - 9) 5 -zeroes from 0 to 5 Main> zeroes 1x->x*x -9) 2 C] *Main> zeroes x -> x*x - 6*x + 5) 10 from O to 10 01,51 -zeroes from 0 to 2 Note: The code for this function shouldn't be complicated. It can be written in a single line (not counting the type declaration), using a list comprehen- 5. In mathematical parlance, a zero of a function f is a value such that f(v) = 0, For example, the function g(x) = x + 7 has the value-7 as a zero (because g(-7) 0), the function h(x)2 -9 has both 3 and -3 as zeroes, and the function j(x+ 15 has no zeroes at all. Write a Haskell function zeroes (Integer -Integer) Integer > [Integer] such that zeroes f limit returns a list containing all of the integer ze- roes of the function f whose values are between O and limit, inclusive. (If limit is less than 0, then the function should return the empty list.) Here are some examples: Main> zeroes ( x->x*x - 9) 5 -zeroes from 0 to 5 Main> zeroes 1x->x*x -9) 2 C] *Main> zeroes x -> x*x - 6*x + 5) 10 from O to 10 01,51 -zeroes from 0 to 2 Note: The code for this function shouldn't be complicated. It can be written in a single line (not counting the type declaration), using a list comprehen

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions