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 custom-set exercise #149

Merged
merged 3 commits into from
Oct 12, 2024
Merged

Add custom-set exercise #149

merged 3 commits into from
Oct 12, 2024

Conversation

ageron
Copy link
Contributor

@ageron ageron commented Oct 11, 2024

I set the difficulty to 3 because almost all functions are trivial except fromList which must get rid of duplicates. Perhaps it should be difficulty 4, please let me know what you think.

Also note that I focused the solution on simplicity, not performance. I considered implementing the list of items as a hash table or a sorted binary tree, but I decided that the objective of the Example.roc code is to ensure that the tests work well in the simplest way possible.

Also, the stub contains this code:

CustomSet := {
    # TODO: change this opaque type however you need
    todo : U64,
    todo2 : U64,
    todo3 : U64,
    # etc.
}
    implements [Eq]

The tests initially used == to compare CustomSet values, but this actually did not call isEq, so the tests would fail if the items inside the set were not in the same order. This is due to roc-lang/roc#7111. So I temporarily replaced == with isEq in the tests, but I left implements [Eq] in the stub and solution, so that we can easily change the tests back to == when the issue is fixed.

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.

Awesome! I would put this as a 4 because it uses opaque types and might not be as straightforward for users who are newer to programming and haven't used sets as much.

@ageron ageron merged commit d53f7d1 into exercism:main Oct 12, 2024
2 checks passed
@ageron ageron deleted the add-custom-set branch October 12, 2024 03:43
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