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

Add two bucket #129

Merged
merged 3 commits into from
Oct 2, 2024
Merged

Add two bucket #129

merged 3 commits into from
Oct 2, 2024

Conversation

ageron
Copy link
Contributor

@ageron ageron commented Oct 1, 2024

That was a fun exercise!

For the solution, I wrote a general-purpose BFS implementation. The advantage is that it can be reused in other exercises (e.g., it would have been handy for the connect exercise). The main downsides are:

  • the bfs function outputs the shortest path even though all we really need is the length of the shortest path
  • as a result, the solution is a bit longer than it could be
  • and the type annotations of the bfs function could potentially be confusing to beginners

I don't think these downsides matter much, given that the .meta/Example.roc file is not shown to the end user, it's mostly there to ensure that the tests work well. Moreover, this exercise has difficulty 6, so it's not really meant for complete beginners, we can assume they understand type annotations by now.

Wdyt?

Copy link
Contributor

@isaacvando isaacvando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! I think this is a great opportunity to show off a general BFS.

neighor -> neighbor

Co-authored-by: Isaac Van Doren <69181572+isaacvando@users.noreply.github.com>
@ageron ageron merged commit 6d443d2 into exercism:main Oct 2, 2024
2 checks passed
@ageron ageron deleted the add-two-bucket branch October 2, 2024 04:35
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.

2 participants