This is a page from my book, Functional Programming, Simplified

## Recursion: How to Write a ‘sum’ Function in Scala

With all of the images of the previous lesson firmly ingrained in your brain, let’s write a `sum`

function using recursion!

## Sketching the `sum`

function signature

Given a `List`

of integers, such as this one:

`val list = List(1, 2, 3, 4)`

let’s start tackling the problem in the usual way, by thinking, “Write the function signature first.”