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

New practice exercise resistor-color-duo #800

Merged
merged 2 commits into from
Jul 1, 2021

Conversation

jiegillet
Copy link
Contributor

New one. Quite simple.
Big brother resistor-color-trio coming up next.

@github-actions
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?
  • Practice exercise changed

    • 🌲 Do prerequisites, practices, and difficulty in config.json need to be updated?
    • 🧑‍🏫 Are the changes in accordance with the community-wide problem specifiations?
  • Practice exercise tests changed

    • ⚪️ Are all tests except the first one skipped?
    • 📜 Does <exercise>/.meta/tests.toml need updating?

Automated comment created by PR Commenter 🤖.

@angelikatyborska angelikatyborska added the x:size/large Large amount of work label Jul 1, 2021
Comment on lines +2669 to +2677
"prerequisites": [
"atoms",
"lists",
"pattern-matching",
"maps"
],
"practices": [
"maps"
],
Copy link
Member

Choose a reason for hiding this comment

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

Interesting. With those prerequisites, resistor-color-duo would be unlocked before resistor-color because resistor-color has an implementation with a list and Enum.find_index(@colors, &(&1 == color)), so it requires enum, and enum comes after all those prerequisites.

We cannot edit resistor-color to NOT use enum because it needs to return all the colors in order, and map keys aren't ordered.

I don't know if that's a problem, but it defies my expectations. I would think that resistor-color is easier than resistor-color-duo, and that resistor-color-duo is easier than resistor-color-trio 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But this one has maps, does that come after lists and enum or is it a different branch?
I could use a list implementation to make them all consistent. To be honest I didn't notice resistor-color existed haha.

Copy link
Member

Choose a reason for hiding this comment

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

lists and maps are required by enum.

I think using a list for this exercise would make it less idiomatic. I guess we need to accept it like it is :)

Copy link
Contributor

Choose a reason for hiding this comment

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

map keys aren't ordered.

100% agree with this statement, it is a common fallacy for students to believe that map keys are ordered just because they appear so in small maps.

Not sure if this is a problem though. This is somewhat similar to the "Instruments of Texas" theme that we reuse in the concept exercises as Maud had designed these exercises as teaching exercises. Each one just teaches something different.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Someone going through all three exercises in a row is likely to reuse the same implementation though. Either with maps or lists. I probably would have written resistor-color with maps as well since lookup is O(1) rather than O(n).

@doc """
Calculate a resistance value from two colors
"""
@spec value(colors :: [atom]) :: integer
Copy link
Member

Choose a reason for hiding this comment

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

I like that the colors are atoms. What do you think about editing resistor-color to also use atoms for the colors? Now they're strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Leave it to me. Maybe we should make the trio all a little bit more consistent on other things as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

@angelikatyborska angelikatyborska requested a review from neenjaw July 1, 2021 07:35
@angelikatyborska
Copy link
Member

I'll merge.
I'm willing to accept that duo and trio come before resistor-color when all have idiomatic solutions 😅 but I'll ask other tracks if they also have this "problem".

@angelikatyborska angelikatyborska merged commit c03873d into exercism:main Jul 1, 2021
@angelikatyborska
Copy link
Member

Derk-Jan Karrenbeld says:
Didactily they must go after resistor-color. If returning the array complicates the exercise too much, I'd remove that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/large Large amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants