Any help with this would be very appreciated.
I am trying to write a function in Haskell to find how many, of three numbers are larger than the average of said three numbers.
The problem is, I am trying to use guards to increment a "sum", but I'm assuming guards only go to whichever the first condition is that's true. Is there a better way to do this?
Here is my code:
howManyAboveAverage :: Int -> Int -> Int -> Int
howManyAboveAverage x y z | aboveAverage x = sum + 1
| aboveAverage y = sum + 1
| aboveAverage z = sum + 1
where
aboveAverage a = a > div (x+y+z) 3
sum = 0