[Haskell-cafe] what do I have to do exactlry with this exercises

Roelof Wobben r.wobben at home.nl
Fri Oct 30 06:20:46 UTC 2015


Hello,

Im self studing Haskell with the Craft o ffunctional programmimg of Hutton.

Now I see two exercises that I do not understand what is really the 
purpose here.

The two exercises are :

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. You might find the max function 
defined in
Section 3.4 useful.
To test this function, add to your script a definition of some values of 
f thus:
f 0 = 0
f 1 = 44
f 2 = 17
f _ = 0
and so on; then test your function at various values.

4.22 Given a function f of type Integer -> Integer give a recursive 
definition of
a function of type Integer -> Bool which on input n returns True if one or
more of the values f 0, f 1, ..., f n is zero and False otherwise.




More information about the Haskell-Cafe mailing list