[Haskell-cafe] what do I have to do exactlry with this exercises
Richard A. O'Keefe
ok at cs.otago.ac.nz
Mon Nov 2 01:36:38 UTC 2015
On 30/10/2015, at 8:05 pm, Roelof Wobben <r.wobben at home.nl> wrote:
>
> Now I have to think about how to read the values of f 1 .. fn 2 .
You "read the value of f 1" by calling f 1.
> I think I need 2 recursive function . One for g x and one for reading f1
NO. You were told to write *A* recursive function.
That's ONE recursive function. That's all you need.
g 0 = the maximum of [f 0] = what?
g n = the maximum of [f 0, f 1, ..., f (n-1), f n]
Now, DO YOU KNOW A FUNCTION THAT YOU CAN CALL TO COMPUTE
the maximum of [f 0, f 1, ..., f (n-1)]
?
Can you see HOW TO COMBINE that answer with f n to get the
final result you want? Is there a function MENTIONED IN
THE PROBLEM that could do this last step?
More information about the Haskell-Cafe
mailing list