Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix explanation on when TCO is triggered in stack safety file #447

Open
JordanMartinez opened this issue Mar 15, 2020 · 0 comments
Open
Labels
bug Something isn't working Design-Patterns Something related to the Design Patterns folder in this repo

Comments

@JordanMartinez
Copy link
Owner

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.

@JordanMartinez JordanMartinez added bug Something isn't working Design-Patterns Something related to the Design Patterns folder in this repo labels Mar 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Design-Patterns Something related to the Design Patterns folder in this repo
Projects
None yet
Development

No branches or pull requests

1 participant