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 resistor-color exercise #1404

Merged
merged 19 commits into from
Dec 1, 2021
Merged

Conversation

still-flow
Copy link
Contributor

Ported over from the C track, but with a Rust-ic flavor. Hopefully the external crate usage is okay.

Copy link
Member

@coriolinus coriolinus left a comment

Choose a reason for hiding this comment

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

Just took a quick look; it's definitely a good start! Some notes:

  • You're going to need to edit the top-level config.json to add the exercise there as well.
  • What is this exercise meant to teach?
  • If we can come up with a good educational goal, then could we structure this exercise as a concept exercise instead of a practice?

still-flow and others added 3 commits November 27, 2021 17:38
per maintainer's suggestion

Co-authored-by: Peter Goodspeed-Niklaus <[email protected]>
Co-authored-by: Peter Goodspeed-Niklaus <[email protected]>
Co-authored-by: Peter Goodspeed-Niklaus <[email protected]>
@still-flow
Copy link
Contributor Author

Re what this exercise teaches: I think it teaches about C-like enums, also about external crate usage. And the neat "{:?}" formatting trick.

As for making this a concept exercise: sure! It's just that I'm new to contributing exercises, so a practice one is certainly easier. However, I'll probably be able to figure things out if necessary.

@still-flow
Copy link
Contributor Author

Re editing top-level config.json: where should I read to learn how to properly do it?

@still-flow
Copy link
Contributor Author

Well, here's my attempt, anyway. Please feel free to correct me.

Copy link
Member

@coriolinus coriolinus left a comment

Choose a reason for hiding this comment

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

Some more notes below.

The biggest comment I have is that we have to decide now if this is going to be a concept exercise; it's not something that can be changed after the exercise goes live. This seems plausible to me for teaching the external_crates concept. Upside: it gets a lot more visibility, as the concepts in Rust still need a lot of fleshing out. Downside: creating the concept requires a fair amount of extra work. If you do decide to convert it to a concept exercise, it should use the enum-iterator crate.

Concept docs, concept exercise docs.

If you don't want to do the extra work, this is also fine as a practice exercise. Just let me know whether you want to convert this or not.

still-flow and others added 3 commits November 29, 2021 16:57
Co-authored-by: Peter Goodspeed-Niklaus <[email protected]>
Co-authored-by: Peter Goodspeed-Niklaus <[email protected]>
@still-flow
Copy link
Contributor Author

Okay, here's all the fixups for now. I think I should try converting this to a concept exercise, but failing that, this should be good for now.

@coriolinus
Copy link
Member

Cool, I'll look forward to seeing how this looks as a concept!

@still-flow
Copy link
Contributor Author

still-flow commented Nov 30, 2021

Alright, here is a rough first version of that. (To be clear, some of the text was liberally adapted from Rust's docs.)

@coriolinus
Copy link
Member

This looks very plausible as a concept to me!

@still-flow
Copy link
Contributor Author

Alright, re-adding the int-enum crate seems to have worked.

Copy link
Member

@coriolinus coriolinus left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for putting in the effort to push this over the finish line.

@coriolinus coriolinus merged commit 0f9f1af into exercism:main Dec 1, 2021
@still-flow
Copy link
Contributor Author

It works! Albeit not without trouble: it would seem that the crates have to be re-fetched on every test instance, which slows tests down considerably, even leading to timeouts sometimes. That's probably why there was a rule against external crates?

@still-flow still-flow deleted the resistor-color branch December 1, 2021 22:06
@coriolinus
Copy link
Member

Hmm, I'm pretty confident that it's not re-fetching the crates each time, because the test runners run offline. That's why there's a list of supported crates in the first place. However, it's worth looking into the timeout rate.

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