Hugs question

Irfon-Kim Ahmad Irfon-Kim Ahmad <irfon@home.com>
Tue, 20 Mar 2001 07:26:23 -0500


>I was suppose to find a function mid3 that takes three integers and returns 
>the middle one in terms of size but i cant seem to get it.
>maybe you can help
>
>mid3 :: Int -> Int -> Int -> Int
>-- mid3 takes three integers and 
>-- returns the middle one in terms of size
>mid3 x y z = min2 x (max2 y z)

The only problem I can see with this definition is that if you hadn't 
previously defined min2 and max2, then it would fail, since these aren't in 
the prelude.  However, if you replace those with min and max, it seems to 
work fine.  I assume that you had to define min2 and max2 previous in your 
exercise.  Maybe you could post those definitions as well as what the problem 
you're encountering is.
-- 
Irfon-Kim Ahmad
http://members.home.com/irfon/ahmadi/