-
Notifications
You must be signed in to change notification settings - Fork 20
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 iterators exercise #161
Conversation
Deploying ferrous-systems-rust-exercises with
|
Latest commit: |
a014833
|
Status: | ✅ Deploy successful! |
Preview URL: | https://798191d7.ferrous-systems-rust-exercises.pages.dev |
Branch Preview URL: | https://iterators-exercise.ferrous-systems-rust-exercises.pages.dev |
I still don't know why the code exits with a 1. |
exercise-book/src/iterators.md
Outdated
|
||
- Take the template in [exercise-templates/iterators](../../exercise-templates/iterators/) as a starting point. | ||
- Replace the first `todo!` item with [reader.lines()]() and continue "chaining" the iterators until you've calculated the desired result. | ||
- Run the code with `cargo run --bin iterators1` when inside the `exercise-templates` directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While for embedded training we expect the group to clone exercises repo and work within it, for our intro exercises we actually prompt them to make a separate new rust project for each of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Rephrased this section. Will wait on another review until I resolve.
exercise-book/src/iterators.md
Outdated
|
||
let result = reader.lines() | ||
.map(|l| l.unwrap()) | ||
.filter_map(|s| s.parse().ok()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I appreciate a gradual progression on the solution, this particular sequence of steps (Step 2 to Step 6) goes against of what we teach people on trainings. They don't "unwarp() now, refactor later
". Instead as soon as trainee sees a Result
, they will think how to properly handle it. The final solution won't have any unwrap / expect
calls in code. So I would give a different hint early: about the fact that in this problem we skip over "bad" lines, and then use this fact to introduce filter_map
as an important method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some suggestions here and there, but very happy with the overall structure: tons of help offered, and the overall flow feels really nice.
Co-authored-by: Andrei Listochkin (Андрей Листочкин) <andrei.listochkin@ferrous-systems.com>
Co-authored-by: Andrei Listochkin (Андрей Листочкин) <andrei.listochkin@ferrous-systems.com>
Co-authored-by: Andrei Listochkin (Андрей Листочкин) <andrei.listochkin@ferrous-systems.com>
Co-authored-by: Andrei Listochkin (Андрей Листочкин) <andrei.listochkin@ferrous-systems.com>
Don't forget to add it to ToC! |
please don't merge things unless CI is green |
No description provided.