From 20024d40c5e121202f283b420d7da1deecf4ebc0 Mon Sep 17 00:00:00 2001 From: mokou Date: Thu, 14 Jul 2022 18:29:09 +0200 Subject: [PATCH] feat(iterators): update hint comments --- exercises/standard_library_types/iterators1.rs | 2 +- exercises/standard_library_types/iterators2.rs | 2 +- exercises/standard_library_types/iterators3.rs | 2 +- exercises/standard_library_types/iterators4.rs | 1 + exercises/standard_library_types/iterators5.rs | 4 +++- info.toml | 7 +++++-- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/exercises/standard_library_types/iterators1.rs b/exercises/standard_library_types/iterators1.rs index 5aa49b6..0379c6b 100644 --- a/exercises/standard_library_types/iterators1.rs +++ b/exercises/standard_library_types/iterators1.rs @@ -6,7 +6,7 @@ // This module helps you get familiar with the structure of using an iterator and // how to go through elements within an iterable collection. // -// Execute `rustlings hint iterators1` for hints :D +// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/standard_library_types/iterators2.rs b/exercises/standard_library_types/iterators2.rs index 87b4eaa..29c53af 100644 --- a/exercises/standard_library_types/iterators2.rs +++ b/exercises/standard_library_types/iterators2.rs @@ -1,7 +1,7 @@ // iterators2.rs // In this exercise, you'll learn some of the unique advantages that iterators // can offer. Follow the steps to complete the exercise. -// As always, there are hints if you execute `rustlings hint iterators2`! +// Execute `rustlings hint iterators2` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/standard_library_types/iterators3.rs b/exercises/standard_library_types/iterators3.rs index ec2e36d..c97a625 100644 --- a/exercises/standard_library_types/iterators3.rs +++ b/exercises/standard_library_types/iterators3.rs @@ -4,7 +4,7 @@ // 1. Complete the divide function to get the first four tests to pass. // 2. Get the remaining tests to pass by completing the result_with_list and // list_of_results functions. -// Execute `rustlings hint iterators3` to get some hints! +// Execute `rustlings hint iterators3` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/standard_library_types/iterators4.rs b/exercises/standard_library_types/iterators4.rs index 0b3b5d8..a02470e 100644 --- a/exercises/standard_library_types/iterators4.rs +++ b/exercises/standard_library_types/iterators4.rs @@ -1,4 +1,5 @@ // iterators4.rs +// Execute `rustlings hint iterators4` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/standard_library_types/iterators5.rs b/exercises/standard_library_types/iterators5.rs index 93f3ae1..0593d12 100644 --- a/exercises/standard_library_types/iterators5.rs +++ b/exercises/standard_library_types/iterators5.rs @@ -6,7 +6,7 @@ // imperative style for loops. Recreate this counting functionality using // iterators. Only the two iterator methods (count_iterator and // count_collection_iterator) need to be modified. -// Execute `rustlings hint iterators5` for hints. +// Execute `rustlings hint iterators5` or use the `hint` watch subcommand for a hint. // // Make the code compile and the tests pass. @@ -34,6 +34,7 @@ fn count_for(map: &HashMap, value: Progress) -> usize { fn count_iterator(map: &HashMap, value: Progress) -> usize { // map is a hashmap with String keys and Progress values. // map = { "variables1": Complete, "from_str": None, ... } + todo!(); } fn count_collection_for(collection: &[HashMap], value: Progress) -> usize { @@ -52,6 +53,7 @@ fn count_collection_iterator(collection: &[HashMap], value: Pr // collection is a slice of hashmaps. // collection = [{ "variables1": Complete, "from_str": None, ... }, // { "variables2": Complete, ... }, ... ] + todo!(); } #[cfg(test)] diff --git a/info.toml b/info.toml index 1ba90d1..33f126e 100644 --- a/info.toml +++ b/info.toml @@ -802,7 +802,8 @@ case is a vector of integers and the failure case is a DivisionError. The list_of_results function needs to return a vector of results. See https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect for how -the `FromIterator` trait is used in `collect()`.""" +the `FromIterator` trait is used in `collect()`. This trait is REALLY powerful! It +can make the solution to this exercise infinitely easier.""" [[exercises]] name = "iterators4" @@ -812,7 +813,9 @@ hint = """ In an imperative language, you might write a for loop that updates a mutable variable. Or, you might write code utilizing recursion and a match clause. In Rust you can take another functional -approach, computing the factorial elegantly with ranges and iterators.""" +approach, computing the factorial elegantly with ranges and iterators. + +Hint 2: Check out the `fold` and `rfold` methods!""" [[exercises]] name = "iterators5"