
30 Oct
2015
30 Oct
'15
7 a.m.
On Fri, Oct 30, 2015 at 8:52 AM, Roelof Wobben wrote:
Let's say f is a recursive function which calculates the fac.
So f 0 = 0 f1 = 1 f2 = 2 f3 = 6
so im my oponion g1 = the answer of f1 which is also the max
But recall the problem definition: 4.21 Given a function f of type Integer -> Integer give a recursive
definition of a function of type Integer -> Integer which on input n returns the maximum of the values f 0, f 1, ..., f n.
It doesn't say anything about f, which means you are not allowed to make assumptions about the definition of f. f could be defined as: f :: Integer -> Integer f 42 = 100 f x = 0 Since you don't know anything about f, you must look at all values from f 0 to f n in order to find the maximum. Regards, Sean