Skip to content

Commit b06f571

Browse files
committed
---
yaml --- r: 5996 b: refs/heads/master c: f1f0e6c h: refs/heads/master v: v3
1 parent f706af7 commit b06f571

File tree

2 files changed

+12
-25
lines changed

2 files changed

+12
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 1a89e589a4c3d8c0119d81c45634dced10f1c541
2+
refs/heads/master: f1f0e6c06c9a208bbcbe48292b7a0ee31edbb114

trunk/src/lib/vec.rs

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -637,43 +637,30 @@ fn enum_uints(start: uint, end: uint) : uint::le(start, end) -> [uint] {
637637
ret r;
638638
}
639639

640-
/*
641-
Function: eachi
642-
643-
Iterates over a vector's elements and indexes
644-
645-
Iterates over vector `v` and, for each element, calls function `f`
646-
with the element's value and index.
647-
*/
648-
fn eachi<T>(f: block(T, uint) -> (), v: [mutable? T]) {
649-
let i = 0u;
650-
let l = len(v);
651-
while (i < l) {
652-
let elem = v[i]; // Satisfy alias checker
653-
f(elem, i);
654-
i += 1u;
655-
}
656-
}
657-
658640
/*
659641
Function: iter
660642
661643
Iterates over a vector
662644
663-
Iterates over vector `v` and, for each element, calls function `f`
645+
Iterates over vector `v` and, for each element, calls function `f` with the
646+
element's value.
647+
664648
*/
665-
fn iter<T>(v: [mutable? T], it: block(T)) {
666-
iter2(v) { |_i, v| it(v) }
649+
fn iter<T>(v: [mutable? T], f: block(T)) {
650+
iter2(v) { |_i, v| f(v) }
667651
}
668652

669653
/*
670654
Function: iter2
671655
672-
FIXME: This is exactly the same as eachi
656+
Iterates over a vector's elements and indexes
657+
658+
Iterates over vector `v` and, for each element, calls function `f` with the
659+
element's value and index.
673660
*/
674-
fn iter2<T>(v: [mutable? T], it: block(uint, T)) {
661+
fn iter2<T>(v: [mutable? T], f: block(uint, T)) {
675662
let i = 0u;
676-
for x in v { it(i, x); i += 1u; }
663+
for x in v { f(i, x); i += 1u; }
677664
}
678665

679666
/*

0 commit comments

Comments
 (0)