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

Maintain the signature of the recursive function identical to that of the loop #1852

Merged
merged 2 commits into from
Jan 13, 2024
Merged

Conversation

herobs
Copy link
Contributor

@herobs herobs commented Jan 11, 2024

No description provided.

@MatthijsBlom
Copy link

The code you changed is replicated in recursion/content.md. I suspect you'd want to change it there too.

@senekor
Copy link
Contributor

senekor commented Jan 11, 2024

What's the motivation for this? Some forum post I missed? A description would've been nice.

Anyway, I like this change. It's cleaner, simpler. A slight downside might be that while Rust doesn't guarantee tail recursion optimization, as is mentionend in the text, it is now impossible. (right?) But since using recursion in Rust over a loop is not a choice one makes for performance reasons, I'm not worried about it.

cc @bobahop, your take would be welcome since you wrote the approach.

@herobs
Copy link
Contributor Author

herobs commented Jan 12, 2024

Sorry for not providing a description and discussing before creating a pull request. As the title states, there is no need to change the recursive function's signature to accommodate the offset argument.

As for tail recursion, they aren't simple tail recursions for both versions.

@senekor senekor merged commit 80cfa61 into exercism:main Jan 13, 2024
10 checks passed
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

Successfully merging this pull request may close these issues.

3 participants