Practice question from Immutability & Expressions
Complete the recursive function to sum a list:
let ____ sum lst =
match lst with
| [] -> 0
| head :: tail -> head + sum tailAnswer
["rec"]
Explanation
The 'rec' keyword tells F# that this function is recursive (calls itself). Without 'rec', the function name wouldn't be in scope within its own body, causing a compiler error.