Fix explanation on when TCO is triggered in stack safety file #447
Labels
bug
Something isn't working
Design-Patterns
Something related to the Design Patterns folder in this repo
Here, I explain that TCO occurs when the last branch calls the function recursively. Based on this understanding, I also mentioned that tailRec is used in cases where multiple branches are needed.
However, Nate pointed out that TCO occurs regardless of the number of branches as long as all of them call the function recursively. I'll need to test this out on my end to better understand the situations that occur with this. In short, the two headers linked above are misleading and inaccurate. I still don't know when one should use recursive functions and when one should use
tailRec
.The text was updated successfully, but these errors were encountered: