Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Language ML. These exercises should all have one-line solutions using map, foldr, or foldl. You can also use other predefined functions, of course, but do
Language ML. These exercises should all have one-line solutions using map, foldr, or foldl. You can also use other predefined functions, of course, but do not write any additional named functions and do not use explicit recursion. If you need helper functions, use anonymous ones. I need help with both exercises.
"la list -> bool so that Exercise 19 Write a function member of type ''a * member(e, L) is true if and only if e is an element of list L. Exercise 25 Represent a polynomial using a list of its (real) coefficients, starting with the constant coefficient and going only as high as necessary. For example, 3x2 + 5x +1 would be represented as the list [1.0,5.0,3.0] and x2+2x as [0.0,-2.0,0.0,1.0]. Write a function eval of type real list -> real -> real that takes a polynomial represented this way and a value for x and returns the value of that polynomial at the given x. For example, eval(1.0,5.0,3.0] 2.0 should evaluate to 23.0, because when x = 2, 3x2 + 5x + 1 = 23. (This is the same as Exercise 5 in Chapter 7, except that it is now a curried function and must be written as a one-liner.)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started