Created
June 24, 2018 17:12
-
-
Save xxxnell/40956ebcacb114bb7ecf22933caa584c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mean[A](as: List[A])(implicit frac: Fractional[A]): A = | |
if (as.nonEmpty) frac.div(as.sum, frac.fromInt(as.length)) else frac.zero |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment