Advertisement
Guest User

Untitled

a guest
May 5th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. minMaxAvgTR :: (Ord a, Fractional a) => [a] -> (a,a,a)
  2. minMaxAvgTR (x:xs) = maxTRh xs x 0 0 0
  3. where
  4. maxTRh [] min max sum listLength = (min, max, (sum / (fromIntegral listLength)))
  5. maxTRh (x:xs) min max sum listLength | x < min = maxTRh xs x max (x + sum) (1 + listLength)
  6. | x > max = maxTRh xs min x (x + sum) (1 + listLength)
  7. | otherwise = maxTRh xs min max (x + sum) (1 + listLength)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement