Practice question from FSharp Programming Advanced

Write a tail-recursive function in F# that calculates the sum of all elements in a list.

Answer

!AI

Explanation

A correct implementation would use pattern matching and an inner helper function with an accumulator to achieve tail recursion.

More questions from Quick: FSharp Programming Advanced