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

recursive function resolution edge case #51

Open
mkhan45 opened this issue Nov 25, 2021 · 2 comments
Open

recursive function resolution edge case #51

mkhan45 opened this issue Nov 25, 2021 · 2 comments

Comments

@mkhan45
Copy link
Owner

mkhan45 commented Nov 25, 2021

let inner_state = (bind thunk_fn.lambda_args thunk_args ss loc) thunk_fn.enclosed_state in

The inner state recursive function needs to be thought about a bit more for continuation passing style to work

@mkhan45 mkhan45 closed this as completed in d1ad18c Dec 4, 2021
mkhan45 added a commit that referenced this issue Dec 10, 2021
This reverts commit d1ad18c.
@mkhan45 mkhan45 reopened this Dec 10, 2021
@mkhan45
Copy link
Owner Author

mkhan45 commented Dec 10, 2021

causes other bugs

@mkhan45
Copy link
Owner Author

mkhan45 commented Dec 11, 2021

worth noting that elixir solves this by not letting closures be trivially recursive, the function has to accept a recursion function argument, e.g.

fib = fn(x, fib) -> if x < 2, do: n, else: fib.(n - 1, fib) + fib.(n - 2, fib) end
fib.(10, fib) |> IO.inspect # 55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant