Recursive Sum in Scala

Computing the total sum of a collection via a recursive Scala function.
def recursiveSum(xs: List[Int]): Int = 
    if (xs.isEmpty) 0
    else (xs.head + recursiveSum(xs.tail))

recursiveSum(List(1, 2, 3))

// res0: Int = 6
Scala
Elixir is a compiled, dynamically-typed, general-purpose, functional programming language developed by Brazilian software developer José Valim, first released in…
Formally, a type class is a type-system construct that supports ad hoc polymorphism. This is achieved by adding constraints to type variables…
We live in an era where reliable data has become an invaluable asset. We’re constantly bombarded with information from…
Over the last two articles of this series, we have discussed different Big Data file formats and their overall…

Request Full Resume