Skip to content

Commit

Permalink
Update about.md (#1279)
Browse files Browse the repository at this point in the history
The accumulator needs to be returned by the functions otherwise the won’t work correctly.
  • Loading branch information
joMarsch authored Sep 18, 2024
1 parent 518d01e commit 5979e3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions concepts/recursion/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Here is a tail-recursive version of the list length function:
```fsharp
let rec lengthRecursive acc list =
match list with
| [] -> 0
| [] -> acc
| x::xs -> lengthRecursive (acc + 1) xs
let length list = lengthRecursive 0 list
Expand All @@ -51,7 +51,7 @@ It is quite common to define the recursive helper as a nested function, which hi
let length list =
let rec lengthRecursive acc remainder =
match remainder with
| [] -> 0
| [] -> acc
| x::xs -> lengthRecursive (acc + 1) xs
lengthRecursive 0 list
Expand Down

0 comments on commit 5979e3c

Please sign in to comment.