diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-01-23 14:59:00 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-01-23 19:06:33 -0800 |
| commit | 5e13d19cc07a1e8fbf478d21cabbd7b9f80e3b54 (patch) | |
| tree | c1fc2dd89c651efa1daa4e7d63c5b82b2a5f4bd2 /src/libstd | |
| parent | 04351a84ca342f4580e40b9c195b5403b864090b (diff) | |
| download | rust-5e13d19cc07a1e8fbf478d21cabbd7b9f80e3b54.tar.gz rust-5e13d19cc07a1e8fbf478d21cabbd7b9f80e3b54.zip | |
s/block()/fn()/g
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/bitv.rs | 2 | ||||
| -rw-r--r-- | src/libstd/ebml.rs | 4 | ||||
| -rw-r--r-- | src/libstd/four.rs | 2 | ||||
| -rw-r--r-- | src/libstd/fun_treemap.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io.rs | 6 | ||||
| -rw-r--r-- | src/libstd/list.rs | 6 | ||||
| -rw-r--r-- | src/libstd/map.rs | 18 | ||||
| -rw-r--r-- | src/libstd/md4.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rope.rs | 10 | ||||
| -rw-r--r-- | src/libstd/smallintmap.rs | 6 | ||||
| -rw-r--r-- | src/libstd/sort.rs | 2 | ||||
| -rw-r--r-- | src/libstd/treemap.rs | 2 | ||||
| -rw-r--r-- | src/libstd/tri.rs | 2 |
13 files changed, 32 insertions, 32 deletions
diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 59e6263f82f..d02d78eaab8 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -53,7 +53,7 @@ fn create(nbits: uint, init: bool) -> t { ret @{storage: storage, nbits: nbits}; } -fn process(v0: t, v1: t, op: block(uint, uint) -> uint) -> bool { +fn process(v0: t, v1: t, op: fn(uint, uint) -> uint) -> bool { let len = vec::len(v1.storage); assert (vec::len(v0.storage) == len); assert (v0.nbits == v1.nbits); diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index 24e072692a9..b76ba4ad9b8 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -73,7 +73,7 @@ fn get_doc(d: doc, tg: uint) -> doc { } } -fn docs(d: doc, it: block(uint, doc)) { +fn docs(d: doc, it: fn(uint, doc)) { let pos = d.start; while pos < d.end { let elt_tag = vint_at(*d.data, pos); @@ -83,7 +83,7 @@ fn docs(d: doc, it: block(uint, doc)) { } } -fn tagged_docs(d: doc, tg: uint, it: block(doc)) { +fn tagged_docs(d: doc, tg: uint, it: fn(doc)) { let pos = d.start; while pos < d.end { let elt_tag = vint_at(*d.data, pos); diff --git a/src/libstd/four.rs b/src/libstd/four.rs index 48b3d919afb..ad44f225f25 100644 --- a/src/libstd/four.rs +++ b/src/libstd/four.rs @@ -195,7 +195,7 @@ Function: all_values Iterates over all truth values by passing them to `blk` in an unspecified order */ -fn all_values(blk: block(v: t)) { +fn all_values(blk: fn(v: t)) { blk(both); blk(four::true); blk(four::false); diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index 8e9839a8901..a2f6b8c225f 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -84,7 +84,7 @@ Function: traverse Visit all pairs in the map in order. */ -fn traverse<K, V: copy>(m: treemap<K, V>, f: block(K, V)) { +fn traverse<K, V: copy>(m: treemap<K, V>, f: fn(K, V)) { alt *m { empty { } node(@k, @v, _, _) { diff --git a/src/libstd/io.rs b/src/libstd/io.rs index 6331e57ea7d..1db355dd385 100644 --- a/src/libstd/io.rs +++ b/src/libstd/io.rs @@ -529,7 +529,7 @@ mod fsync { // fsync file after executing blk // FIXME find better way to create resources within lifetime of outer res fn FILE_res_sync(&&file: FILE_res, opt_level: option::t<level>, - blk: block(&&res<os::libc::FILE>)) { + blk: fn(&&res<os::libc::FILE>)) { blk(res({ val: *file, opt_level: opt_level, fsync_fn: fn@(&&file: os::libc::FILE, l: level) -> int { @@ -540,7 +540,7 @@ mod fsync { // fsync fd after executing blk fn fd_res_sync(&&fd: fd_res, opt_level: option::t<level>, - blk: block(&&res<fd_t>)) { + blk: fn(&&res<fd_t>)) { blk(res({ val: *fd, opt_level: opt_level, fsync_fn: fn@(&&fd: fd_t, l: level) -> int { @@ -553,7 +553,7 @@ mod fsync { iface t { fn fsync(l: level) -> int; } // Call o.fsync after executing blk - fn obj_sync(&&o: t, opt_level: option::t<level>, blk: block(&&res<t>)) { + fn obj_sync(&&o: t, opt_level: option::t<level>, blk: fn(&&res<t>)) { blk(res({ val: o, opt_level: opt_level, fsync_fn: fn@(&&o: t, l: level) -> int { ret o.fsync(l); } diff --git a/src/libstd/list.rs b/src/libstd/list.rs index b05f895c327..2081a21de23 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -46,7 +46,7 @@ ls - The list to fold z - The initial value f - The function to apply */ -fn foldl<T: copy, U>(ls: list<U>, z: T, f: block(T, U) -> T) -> T { +fn foldl<T: copy, U>(ls: list<U>, z: T, f: fn(T, U) -> T) -> T { let accum: T = z; iter(ls) {|elt| accum = f(accum, elt);} accum @@ -61,7 +61,7 @@ Apply function `f` to each element of `v`, starting from the first. When function `f` returns true then an option containing the element is returned. If `f` matches no elements then none is returned. */ -fn find<T: copy, U: copy>(ls: list<T>, f: block(T) -> option::t<U>) +fn find<T: copy, U: copy>(ls: list<T>, f: fn(T) -> option::t<U>) -> option::t<U> { let ls = ls; while true { @@ -164,7 +164,7 @@ Function: iter Iterate over a list */ -fn iter<T>(l: list<T>, f: block(T)) { +fn iter<T>(l: list<T>, f: fn(T)) { alt l { cons(hd, tl) { f(hd); diff --git a/src/libstd/map.rs b/src/libstd/map.rs index c3517d4d3f6..ed37318246b 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -88,17 +88,17 @@ iface map<K: copy, V: copy> { Iterate over all the key/value pairs in the map */ - fn items(block(K, V)); + fn items(fn(K, V)); /* Method: keys Iterate over all the keys in the map */ - fn keys(block(K)); + fn keys(fn(K)); /* Iterate over all the values in the map */ - fn values(block(V)); + fn values(fn(V)); } // FIXME: package this up and export it as a datatype usable for @@ -246,7 +246,7 @@ mod chained { } fn foreach_entry<K: copy, V: copy>(chain0: chain<K,V>, - blk: block(@entry<K,V>)) { + blk: fn(@entry<K,V>)) { let chain = chain0; while true { alt chain { @@ -261,7 +261,7 @@ mod chained { } fn foreach_chain<K: copy, V: copy>(chains: [const chain<K,V>], - blk: block(@entry<K,V>)) { + blk: fn(@entry<K,V>)) { let i = 0u, n = vec::len(chains); while i < n { foreach_entry(chains[i], blk); @@ -281,7 +281,7 @@ mod chained { } } - fn items<K: copy, V: copy>(tbl: t<K,V>, blk: block(K,V)) { + fn items<K: copy, V: copy>(tbl: t<K,V>, blk: fn(K,V)) { let tbl_chains = tbl.chains; // Satisfy alias checker. foreach_chain(tbl_chains) { |entry| let key = entry.key; @@ -310,11 +310,11 @@ mod chained { fn remove(k: K) -> option::t<V> { remove(self, k) } - fn items(blk: block(K, V)) { items(self, blk); } + fn items(blk: fn(K, V)) { items(self, blk); } - fn keys(blk: block(K)) { items(self) { |k, _v| blk(k) } } + fn keys(blk: fn(K)) { items(self) { |k, _v| blk(k) } } - fn values(blk: block(V)) { items(self) { |_k, v| blk(v) } } + fn values(blk: fn(V)) { items(self) { |_k, v| blk(v) } } } fn mk<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>) -> map<K,V> { diff --git a/src/libstd/md4.rs b/src/libstd/md4.rs index 2d06c74f336..7b5320a5dfc 100644 --- a/src/libstd/md4.rs +++ b/src/libstd/md4.rs @@ -81,7 +81,7 @@ fn md4(msg: [u8]) -> {a: u32, b: u32, c: u32, d: u32} { fn md4_str(msg: [u8]) -> str { let {a, b, c, d} = md4(msg); - fn app(a: u32, b: u32, c: u32, d: u32, f: block(u32)) { + fn app(a: u32, b: u32, c: u32, d: u32, f: fn(u32)) { f(a); f(b); f(c); f(d); } let result = ""; diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index 9290bf8992e..5e856ff5e0e 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -419,7 +419,7 @@ Returns: `true` If execution proceeded correctly, `false` if it was interrupted, that is if `it` returned `false` at any point. */ -fn loop_chars(rope: rope, it: block(char) -> bool) -> bool { +fn loop_chars(rope: rope, it: fn(char) -> bool) -> bool { alt(rope) { node::empty { ret true } node::content(x) { ret node::loop_chars(x, it) } @@ -435,7 +435,7 @@ Parameters: rope - A rope to traverse. It may be empty it - A block to execute with each consecutive character of the rope. */ -fn iter_chars(rope: rope, it: block(char)) { +fn iter_chars(rope: rope, it: fn(char)) { loop_chars(rope) {|x| it(x); ret true @@ -466,7 +466,7 @@ Returns: `true` If execution proceeded correctly, `false` if it was interrupted, that is if `it` returned `false` at any point. */ -fn loop_leaves(rope: rope, it: block(node::leaf) -> bool) -> bool{ +fn loop_leaves(rope: rope, it: fn(node::leaf) -> bool) -> bool{ alt(rope) { node::empty { ret true } node::content(x) {ret node::loop_leaves(x, it)} @@ -1135,7 +1135,7 @@ mod node { ret result; } - fn loop_chars(node: @node, it: block(char) -> bool) -> bool { + fn loop_chars(node: @node, it: fn(char) -> bool) -> bool { ret loop_leaves(node, {|leaf| ret str::loop_chars_sub(*leaf.content, leaf.byte_offset, @@ -1159,7 +1159,7 @@ mod node { `true` If execution proceeded correctly, `false` if it was interrupted, that is if `it` returned `false` at any point. */ - fn loop_leaves(node: @node, it: block(leaf) -> bool) -> bool{ + fn loop_leaves(node: @node, it: fn(leaf) -> bool) -> bool{ let current = node; while true { alt(*current) { diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index 36c9e1281c2..dada53f355b 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -110,7 +110,7 @@ impl <V: copy> of map::map<uint, V> for smallintmap<V> { fn get(&&key: uint) -> V { get(self, key) } fn find(&&key: uint) -> option::t<V> { find(self, key) } fn rehash() { fail } - fn items(it: block(&&uint, V)) { + fn items(it: fn(&&uint, V)) { let idx = 0u; for item in self.v { alt item { @@ -122,14 +122,14 @@ impl <V: copy> of map::map<uint, V> for smallintmap<V> { idx += 1u; } } - fn keys(it: block(&&uint)) { + fn keys(it: fn(&&uint)) { let idx = 0u; for item in self.v { if item != none { it(idx); } idx += 1u; } } - fn values(it: block(V)) { + fn values(it: fn(V)) { for item in self.v { alt item { some(elt) { it(elt); } _ {} } } diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 8739e8d81c5..f7f6812d7de 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -10,7 +10,7 @@ export quick_sort; export quick_sort3; /* Type: lteq */ -type lteq<T> = block(T, T) -> bool; +type lteq<T> = fn(T, T) -> bool; /* Function: merge_sort diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index 7e181a80457..4771bc3196b 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -83,7 +83,7 @@ Function: traverse Visit all pairs in the map in order. */ -fn traverse<K, V>(m: treemap<K, V>, f: block(K, V)) { +fn traverse<K, V>(m: treemap<K, V>, f: fn(K, V)) { alt *m { empty { } node(k, v, _, _) { diff --git a/src/libstd/tri.rs b/src/libstd/tri.rs index 558a45f475a..7cc749429ce 100644 --- a/src/libstd/tri.rs +++ b/src/libstd/tri.rs @@ -164,7 +164,7 @@ Function: all_values Iterates over all truth values by passing them to `blk` in an unspecified order */ -fn all_values(blk: block(v: t)) { +fn all_values(blk: fn(v: t)) { blk(tri::false); blk(unknown); blk(tri::true); |
