Created
January 17, 2017 08:28
-
-
Save rohinp/044f0357e459d0543a9a7a4e6e81e109 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
//this wont work as type T is unware of the operation + | |
//value 0 is not a zero value for type T | |
def summ[T](xs:List[T]):T = xs.foldLeft(0)(_ + _) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment