Skip to content

Instantly share code, notes, and snippets.

@rohinp
Created January 17, 2017 08:28
Show Gist options
  • Save rohinp/044f0357e459d0543a9a7a4e6e81e109 to your computer and use it in GitHub Desktop.
Save rohinp/044f0357e459d0543a9a7a4e6e81e109 to your computer and use it in GitHub Desktop.
//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