Added iterators5.rs exercise.#646
Conversation
|
👍 I like the idea behind this exercise |
|
This exercise does not use actual progress data. It only simulates progress. The strings that are used as keys can be anything. They just happen to be filenames from the exercises. If the exercise files are renamed, exercises are deleted, or new exercises are added this exercise will still work. |
|
Sorry for the confusion @apogeeoak, I'll update my previous comment |
manyinsects
left a comment
There was a problem hiding this comment.
Overall a great concept! I have some ideas that could make this exercise a little easier to approach, feel free to implement those.
| @@ -0,0 +1,113 @@ | |||
| // iterators5.rs | |||
|
|
|||
| // Rustling progress is modelled using a hash map. The name of the exercise is | |||
There was a problem hiding this comment.
| // Rustling progress is modelled using a hash map. The name of the exercise is | |
| // Let's reimplement a simple version of Rustlings exercise progress! | |
| // This will be modelled using a hash map. The name of the exercise is |
| // Make the code compile and the tests pass. | ||
|
|
||
| // I AM NOT DONE | ||
|
|
There was a problem hiding this comment.
Generally, I would leave comments somewhere in this exercise with notes that explain:
- What a "stack" is (aka a vec of hashmaps)
- That you probably shouldn't touch the
_formethods, but rather implement the iterative version in the other methods - A delineator above the tests module telling the user not to touch what's below it
| count | ||
| } | ||
|
|
||
| fn count(map: &HashMap<String, Progress>, value: Progress) -> usize { |
There was a problem hiding this comment.
I'd rename these to count_iterator or something, to keep them separate from the _for methods.
|
Thanks for the suggestions. I improved the exercise explanation and clarified which functions need modified. I renamed |
Added iterators5.rs exercise.
Added iterators5.rs exercise.
Added an iterator exercise that counts values in a hash map that equal a given value.
Incorporates more iterator methods into the exercises. Provides a use case for the
foldmethod.