Question: ( 2 0 points ) A polynomial could be represented by a list of pairs where each pair coefficient and an exponent. For example, the

(20 points)A polynomial could be represented by a list of pairs where each pair coefficient and an exponent. For example, the list '((1.3)(2.2)(3.1)(4.0)) represents the polynomial x3+2x2+3x+4.
Write a Scheme function called (eval-poly p x) that evaluates the polynomial p for value x
>(define poly1'((1.3)(2.2)(3.1)(4.0)))
>(define poly2'((2.2)(4.1)(5.0)))
>(eval-poly poly11)
10
>(eval-poly poly13)
58
>(eval-poly poly22)
21
>(eval-poly poly27)
131
Write a Scheme function called (get-poly-fun p) that returns a function that takes a single parameter which evaluates polynomial p at that value.
>((get-poly-fun poly1)10)
1234
>((get-poly-fun poly1)1)
10
>(define f1(get-poly-fun poly1))
>(define f2(get-poly-fun poly2))
>(f13)
58
>(f22)
21
>(f27)
131

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 Programming Questions!