diff --git a/doc/tutorial.md b/doc/tutorial.md index ccb22c5b5cd3c..dec2ab29caa79 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1971,18 +1971,18 @@ they apply to. Thus, Rust allows functions and datatypes to have type parameters. ~~~~ -fn for_rev(v: ~[T], act: fn(T)) { - let mut i = vec::len(v); +fn for_rev(vector: ~[T], action fn(T)) { + let mut i = vec::len(vector); while i > 0u { i -= 1u; - act(v[i]); + action(vector[i]); } } -fn map(v: ~[T], f: fn(T) -> U) -> ~[U] { - let mut acc = ~[]; - for v.each |elt| { vec::push(acc, f(elt)); } - ret acc; +fn map(vector: ~[T], function :fn(T) -> U) -> ~[U] { + let mut accumulator = ~[]; + for vector.each |elt| { vec::push(accumulator, function(elt)); } + ret accumulator; } ~~~~