This is a page from my book, Learning Functional Programming in Scala
Given the background information of the previous lesson, let’s take a visual look at how the JVM stack and stack frames work by going back to our recursive sum function from the previous lesson.
sum function is initially called, the only thing on the call stack is the application’s
Then main calls
List(1,2,3), which I show here without the “List” to keep things simple: