Scala reduce
The best way to explain reduce is to create a little helper method you can pass into it. For example, this is an add method that adds two integers together, and also gives us some nice debug output:
It takes a function (or anonymous function) and applies that function to successive elements in the list.