The exact problem I need to work out is below.
Basically, I am given a list of real numbers, representing coefficients. The first element is the constant value, and all that follow it are the coefficients of the polynomial equation. So, eval[1.0, 5.0, 3.0] 2.0 would be constructing the equation "1 + 5x + 3x^2" and evaluating it at 2.0, resulting in 23.0. The function needs to be of type "real list -> real -> real".
Now, what I need to do is implement eval within SML using a curried function, so that it is all one line, and there are no recursive calls. I've already done the recursive way and understand that, but am having troubles wrapping my mind around the curried way. We need to use functions like map, foldr, and foldl to accomplish this, as well as anonymous functions. My thought about this was to for the function to take the list and take just the tail of it (all but head element, which is the constant), and evaluate that, using foldl. The problem I run into is I'm not sure if that is even possible, or how to accomplish this with keeping track of how far into the list I've gone (a counter), so that I could properly use their powers.
Any help at all would be greatly appreciated.