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

Chapter 8: Fibonacci to PTC form? #173

Open
mulongjiangliu opened this issue Nov 17, 2018 · 0 comments
Open

Chapter 8: Fibonacci to PTC form? #173

mulongjiangliu opened this issue Nov 17, 2018 · 0 comments

Comments

@mulongjiangliu
Copy link

mulongjiangliu commented Nov 17, 2018

Loved the in-depth coverage and explanations of this series . And it's easy to understand for newcomers who are fresh to FP.

In Continuation Passing Style (CPS) of Chapter 8, it is said that Fibonacci recursion cannot practically be refactored to pure PTC. It confuses me there. As I find below code, though it lost some readability.

function fib(x, res = 1, pre = 1) { if (x <= 1) return res; return fib(x - 1, pre, pre + res) }

Is above fib a pure PTC form?
Any Comments are welcome and appreciated.

@mulongjiangliu mulongjiangliu changed the title Chapter 9: Fibonacci to PTC form? Chapter 8: Fibonacci to PTC form? Nov 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants