
hi, I am only a beginner of programming with Haskell, how do I define each of the following: * maxFirst :: (Int,Int) -> (Int,Int) -> (Int,Int) which returns, of its two input tuples, the one whose first component is the highest. * Define a function maximumFirst :: [(Int,Int)] -> (Int,Int) which returns, from its list of input tuples, the tuple whose first component is highest, assuming input list is non-empty. A function is given: maxf :: [Int] -> Int such that if maxf [x1,....,xn] = xi then elem xi [x1,...,xn] == True f xi >= f x1 f xi >= f x2 ...... fxi >= f xn * How do you define the function maxf (above) which returns the element of its non-empty input list for which f is maximal. *and to define a function minf which returns the element from its non-empty input list for which f is minimal. *how do I define the function maxIndexf :: [Int] -> Int such that if maxf xs = i for non-empty xs, then 0 <= i < length xs f (x s !! i) >= f (x s !! 0) f (x s !! i) >= f (x s !! 1) .... f (x s !! i) >= f (last xs) that is it returns the index of the element of its input list for which f is maximal. __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This looks like a homework! Do you think this would not be plagiarism?
- --
Eray Ozkural (exa)
participants (2)
-
Eray Ozkural (exa)
-
J Brown