Skip to content

Add new concept mapsets and concept exercise gotta-snatch-em-all #1578

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

Merged
merged 11 commits into from
Jul 5, 2025

Conversation

jiegillet
Copy link
Contributor

@jiegillet jiegillet commented Jun 16, 2025

This PR add new concept and concept exercise, both forked from the Elm track.

Full disclosure, I used AI (via Cursor) to help translate from one language to the other, and event though I combed through everything and edited a lot of things, it was a huge time saver.

There might be stylistic differences between tracks that I'm blind to, I'm happy to change anything.

The CI is expected to fail until the about.md is finalized, then I'll copy it to introduction.md (let me know if you think some parts should be cut down) and use the generator to add the intro file to the exercise.

Copy link
Contributor

Thank you for contributing to exercism/elixir 💜 🎉. This is an automated PR comment 🤖 for the maintainers of this repository that helps with the PR review process. You can safely ignore it and wait for a maintainer to review your changes.

Based on the files changed in this PR, it would be good to pay attention to the following details when reviewing the PR:

  • General steps

    • 🏆 Does this PR need to receive a label with a reputation modifier (x:size/{tiny,small,medium,large,massive})? (A medium reputation amount is awarded by default, see docs)
  • Any exercise changed

    • 👤 Does the author of the PR need to be added as an author or contributor in <exercise>/.meta/config.json (see docs)?
    • 🔬 Do the analyzer and the analyzer comments exist for this exercise? Do they need to be changed?
    • 📜 Does the design file (<exercise>/.meta/design.md) need to be updated to document new implementation decisions?
  • Concept exercise changed

    • 🌲 Do prerequisites and practices in config.json need to be updated?
    • 📖 Does the concept introduction provide all necessary information to solve this exercise?
  • Concept exercise tests changed

    • ⚪️ Are all tests un-skipped?
    • 🔢 Are all tests annotated with @tag task_id?
    • 🐈 Can all tests be understood by reading the test's block only (e.g. no module attributes, no setup functions)?
  • Concept changed

    • 👤 Does the author of the PR need to be added as an author or contributor in <concept>/.meta/config.json (see docs)?
    • 📖 Does the concept introduction provide all necessary information to solve this exercise?

Automated comment created by PR Commenter 🤖.

@jiegillet jiegillet marked this pull request as ready for review June 21, 2025 03:23
Copy link
Member

@angelikatyborska angelikatyborska left a comment

Choose a reason for hiding this comment

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

Excellent exercise, very good about.me, I had no trouble solving it and learned new things 🙌

Comment on lines 14 to 15
- Use [this `MapSet` function][put]
- Use [that `MapSet` function][member]
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: It would be nice if there was a better indicator of the difference between those two functions than just "this" and "that". Maybe describing briefly their purpose, like the other links? "To add card to a collection...", "To check whether...".

(Same nitpick about step 5 hints)

You cannot trade a card you don't have, and you shouldn't trade a card for one that you already have.

Implement `trade_card`, that takes two cards to trade (yours and theirs) and your current collection.
The return value is a tuple of two values: a `Bool` stating if the trade is possible and worth doing, and the collection you would end up with if you did the trade (even if it's not actually possible).
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: Bool is a description for the boolean type that I would expect in an object-oriented programming language that literally has a class called Bool.

Suggested change
The return value is a tuple of two values: a `Bool` stating if the trade is possible and worth doing, and the collection you would end up with if you did the trade (even if it's not actually possible).
The return value is a tuple of two values: a boolean stating if the trade is possible and worth doing, and the collection you would end up with if you did the trade (even if it's not actually possible).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, it's a leftover from the Elm instructions, where Bool is a type.

Implement `new_collection`, which transforms a card into a collection.

```elixir
new_collection("Newthree")
Copy link
Member

Choose a reason for hiding this comment

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

I think in all Elixir concept exercises, we demo the function calls using the module name too

Suggested change
new_collection("Newthree")
GottaSnatchEmAll.new_collection("Newthree")


```elixir
MapSet.new()
# => MapSet.new([])
Copy link
Member

Choose a reason for hiding this comment

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

I had to do a double-take to believe that this is how the REPL prints that value 😂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it used to be something like #MapSet<> or whatever, but they've been moving away from these notations to things that you can copy/paste. In that sense, this is the best way to represent sets :)

Copy link
Member

Choose a reason for hiding this comment

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

That's so clever! I've always been annoyed at those # things that I couldn't copy-paste. I think they showed up most often for Ecto structs.

config.json Outdated
"pattern-matching",
"booleans"
],
"status": "beta"
Copy link
Member

Choose a reason for hiding this comment

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

Lol, there are concept exercises are in "beta"? Maybe we should just make all of the "active"

@jiegillet
Copy link
Contributor Author

very good about.me

Sorry, but this was not about you, it was about sets! 🤣

I'm glad you like the PR, thanks for the review, I've addressed your comments in the relevantly named commits.

Copy link
Member

@angelikatyborska angelikatyborska left a comment

Choose a reason for hiding this comment

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

🚢

@angelikatyborska angelikatyborska merged commit 64d675e into main Jul 5, 2025
9 checks passed
@angelikatyborska angelikatyborska deleted the jie-mapset branch July 5, 2025 06:21
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