Exercise on Functions (Polynomial Evaluation)

Note that this exercise is taken from "Programming in Lua" by Roberto Ierusalimschy

  • Hands on Exercise

A polynomial can be written as y = anxn + an-1xn-1 + ... + a0x0

Write a function that performs polynomial evaluation as a function with a curried tail call.
A. This function will take one parameter that will be a table of the "a" coefficients
B. A curried tail call is a call that returns a function
C. Generally that function is written as an anonymous function as part of the return statement
D. The returned function will take one parameter that will be the value of the variable "x" 
E. The polynomial evaluation will be in the anonymous function
```