<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 30, 2015 at 8:40 AM, Roelof Wobben wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Op 30-10-2015 om 07:35 schreef Sean
Leather:<br>
</div><span class="">
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Fri, Oct 30, 2015 at 8:20 AM,
Roelof Wobben wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Im
self studing Haskell with the Craft o ffunctional
programmimg of Hutton.<br>
<br>
Now I see two exercises that I do not understand what is
really the purpose here.<br>
</blockquote>
<div><br>
</div>
Maybe a slight rewording of the instructions would help? (It
helped me!)
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">The
two exercises are :<br>
<br>
4.21 Given a function f of type Integer -> Integer give
a recursive definition of a<br>
function of type Integer -> Integer which on input n
returns the maximum<br>
of the values f 0, f 1, ..., f n. [...]<br>
</blockquote>
<div> </div>
<div>Given:</div>
<div><br>
</div>
<div> f :: Integer -> Integer</div>
<div><br>
</div>
<div>Define:</div>
<div><br>
</div>
<div> g :: Integer -> Integer</div>
<div> g n = ...</div>
<div><br>
</div>
<div>such that g is defined recursively. g n returns the
maximum of f 0, f 1, ..., f n.</div>
</div>
</div>
</div>
</blockquote>
<br></span>
Thanks, <br>
<br>
But is the maxium not always the last answer.<br></div></blockquote><div><br></div><div>Indeed, it is not.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
So the max of g 1 = answer g1 ??</div></blockquote><div><br></div><div>The value of g 0 is f 0. The value of g 1 is either f 0 or f 1, whichever is greater. The value of g 2 is one of f 0, f 1, or f 2, whichever is greatest. And so on.</div><div><br></div><div>Regards,</div><div>Sean</div></div></div></div>