Question: 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.

Language ML. These exercises should all have one-line solutions using map, foldr,

"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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!