Skip to content

Commit 2b85817

Browse files
committed
Convert various functions in std to take lambda blocks
1 parent cf26241 commit 2b85817

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/lib/fun_treemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Function: traverse
8484
8585
Visit all pairs in the map in order.
8686
*/
87-
fn traverse<K, V>(m: treemap<K, V>, f: fn(K, V)) {
87+
fn traverse<K, V>(m: treemap<K, V>, f: block(K, V)) {
8888
alt *m {
8989
empty. { }
9090
node(@k, @v, _, _) {

src/lib/treemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Function: traverse
8383
8484
Visit all pairs in the map in order.
8585
*/
86-
fn traverse<K, V>(m: treemap<K, V>, f: fn@(K, V)) {
86+
fn traverse<K, V>(m: treemap<K, V>, f: block(K, V)) {
8787
alt *m {
8888
empty. { }
8989
node(k, v, _, _) {

src/lib/vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Type: init_op
4848
4949
A function used to initialize the elements of a vector.
5050
*/
51-
type init_op<T> = fn@(uint) -> T;
51+
type init_op<T> = block(uint) -> T;
5252

5353
/*
5454
Function: init_fn
@@ -327,7 +327,7 @@ v - The vector to grow
327327
n - The number of elements to add
328328
init_fn - A function to call to retreive each appended element's value
329329
*/
330-
fn grow_fn<T>(&v: [T], n: uint, init_fn: fn(uint) -> T) {
330+
fn grow_fn<T>(&v: [T], n: uint, init_fn: block(uint) -> T) {
331331
reserve(v, next_power_of_two(len(v) + n));
332332
let i: uint = 0u;
333333
while i < n { v += [init_fn(i)]; i += 1u; }
@@ -513,7 +513,7 @@ Function: position_pred
513513
514514
Find the first index for which the value matches some predicate
515515
*/
516-
fn position_pred<T>(f: fn(T) -> bool, v: [T]) -> option::t<uint> {
516+
fn position_pred<T>(f: block(T) -> bool, v: [T]) -> option::t<uint> {
517517
let i: uint = 0u;
518518
while i < len(v) { if f(v[i]) { ret some::<uint>(i); } i += 1u; }
519519
ret none;

0 commit comments

Comments
 (0)