Fixed typo.
[rust-101.git] / src / part10.rs
index b586cd5057d3da50b4319dc207d324c589f2e4c0..0c90369c47145464411d557acc2f44fcb74d6788 100644 (file)
@@ -81,7 +81,7 @@ impl BigInt {
 pub fn print_with_prefix(b: &BigInt, prefix: String) {
     //@ The syntax for closures is `|arg1, arg2, ...| code`. Notice that the closure can reference variables like `prefix` that it did not
     //@ take as argument - variables that happen to be present *outside* of the closure. We say that the closure *captures*
-    //@ variables. Rust will now automatically create a type (like `PrintWithStruct`) for the environment of the closure
+    //@ variables. Rust will now automatically create a type (like `PrintWithString`) for the environment of the closure
     //@ with fields for every captured variable, implement the closure trait for this type such that the action performed
     //@ is given by the code of the closure, and finally it will instantiate the environment type here at the definition site
     //@ of the closure and fill it appropriately.
@@ -108,7 +108,7 @@ pub fn print_and_count(b: &BigInt) {
 //@ Rust provides a whole lot of methods on iterators that allow us to write pretty functional-style list manipulation.
 
 // Let's say we want to write a function that increments every entry of a `Vec` by some number, then looks for numbers larger than some threshold, and prints them.
-fn inc_print_even(v: &Vec<i32>, offset: i32, threshold: i32) {
+fn inc_print_threshold(v: &Vec<i32>, offset: i32, threshold: i32) {
     //@ `map` takes a closure that is applied to every element of the iterator. `filter` removes elements
     //@ from the iterator that do not pass the test given by the closure.
     //@ 
@@ -141,4 +141,4 @@ fn filter_vec_by_divisor(v: &Vec<i32>, divisor: i32) -> Vec<i32> {
 // product of those numbers that sit at odd positions? A function that checks whether a vector contains a certain number? Whether all numbers are
 // smaller than some threshold? Be creative!
 
-//@ [index](main.html) | [previous](part09.html) | [raw source](https://www.ralfj.de/git/rust-101.git/blob_plain/HEAD:/workspace/src/part10.rs) | [next](part11.html)
+//@ [index](main.html) | [previous](part09.html) | [raw source](workspace/src/part10.rs) | [next](part11.html)