rename iter2 to iteri to match typical convention

This commit is contained in:
Niko Matsakis
2011-12-16 06:55:42 -08:00
parent 2833ca478c
commit ac6aba016e
3 changed files with 13 additions and 13 deletions

View File

@@ -697,18 +697,18 @@ element's value.
*/
fn iter<T>(v: [const T], f: block(T)) {
iter2(v) { |_i, v| f(v) }
iteri(v) { |_i, v| f(v) }
}
/*
Function: iter2
Function: iteri
Iterates over a vector's elements and indexes
Iterates over vector `v` and, for each element, calls function `f` with the
element's value and index.
*/
fn iter2<T>(v: [const T], f: block(uint, T)) {
fn iteri<T>(v: [const T], f: block(uint, T)) {
let i = 0u, l = len(v);
while i < l { f(i, v[i]); i += 1u; }
}
@@ -723,18 +723,18 @@ element's value.
*/
fn riter<T>(v: [const T], f: block(T)) {
riter2(v) { |_i, v| f(v) }
riteri(v) { |_i, v| f(v) }
}
/*
Function: riter2
Function: riteri
Iterates over a vector's elements and indexes in reverse
Iterates over vector `v` and, for each element, calls function `f` with the
element's value and index.
*/
fn riter2<T>(v: [const T], f: block(uint, T)) {
fn riteri<T>(v: [const T], f: block(uint, T)) {
let i = len(v);
while 0u < i {
i -= 1u;