Book exercise

Chrystall m.chrystall@xtra.co.nz
Tue, 15 Feb 2000 05:18:35 +1300


One of the exercises at the end of the first chapter of the clean book
"Define a function 'max' with two arguments that delivers the maximum of the
two." posed for me, as a newbie to functional programming (and programming
in general) a problem. My original code was as follows: 

Max :: a a -> a | > a
Max x y
 |y > x     = y
 |otherwise = x

which produced this message "> not defined as a class symbol". I
automatically assumed that therefore < would not be also (which struck me as
strange indeed (I can see now that only one would be defined as a class
variable(but after i had allready delegated  < as not working either I did
not think about it.(for a while)))).

 I don't know if it was intended for the student to use variable types but I
assume that was the point.
Perhaps it should be noted that < can be used but not >.

I assume posting this will reach the relevant person/s?

sorry about the weird wordings its too late to think clearly- Sam