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
Of all the libraries belonging to any Data Scientist’s toolbox, Pandas may be the most important one; it’s built on top…
In the last part of this 3-segment Guided Project, we introduced the concept of Exploratory Data Analysis (EDA). We…
A filesystem is a method and data structure used by operating systems to manage how data is stored, organized and retrieved….
Writing code can be as simple as importing the required libraries, declaring our variables, functions, and classes as required,…

Request Full Resume