Skip to content

Commit 01b3778

Browse files
committed
---
yaml --- r: 96106 b: refs/heads/dist-snap c: 74d2731 h: refs/heads/master v: v3
1 parent 5c335af commit 01b3778

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 89a9ce0cc6ecd8c1369bede6916ef9e27bcc0ee8
9+
refs/heads/dist-snap: 74d27311a7ecb50b4783b6adc4a977a6e51759b2
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/test/bench/shootout-meteor.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,13 @@
1414

1515
// returns an infinite iterator of repeated applications of f to x,
1616
// i.e. [x, f(x), f(f(x)), ...], as haskell iterate function.
17-
fn iterate<'a, T>(f: &'a fn(&T) -> T, x: T) -> Iterate<'a, T> {
18-
Iterate::new(f, x)
17+
fn iterate<'a, T>(x: T, f: &'a fn(&T) -> T) -> Iterate<'a, T> {
18+
Iterate {f: f, next: x}
1919
}
2020
struct Iterate<'self, T> {
2121
priv f: &'self fn(&T) -> T,
2222
priv next: T
2323
}
24-
impl<'self, T> Iterate<'self, T> {
25-
fn new<'a>(f: &'a fn(&T) -> T, x: T) -> Iterate<'a, T> {
26-
Iterate {f: f, next: x}
27-
}
28-
}
2924
impl<'self, T> Iterator<T> for Iterate<'self, T> {
3025
fn next(&mut self) -> Option<T> {
3126
let mut res = (self.f)(&self.next);
@@ -71,11 +66,11 @@ impl<'self, T> Iterator<&'self T> for ListIterator<'self, T> {
7166
fn transform(p: ~[(int, int)], all: bool) -> ~[~[(int, int)]] {
7267
let mut res =
7368
// rotations
74-
iterate(|p| p.iter().map(|&(y, x)| (x + y, -y)).collect(), p)
69+
iterate(p, |p| p.iter().map(|&(y, x)| (x + y, -y)).collect())
7570
.take(if all {6} else {3})
7671
// mirror
7772
.flat_map(|p| {
78-
iterate(|p| p.iter().map(|&(y, x)| (x, y)).collect(), p).take(2)
73+
iterate(p, |p| p.iter().map(|&(y, x)| (x, y)).collect()).take(2)
7974
}).to_owned_vec();
8075

8176
// translating to (0, 0) as minimum coordinates.

0 commit comments

Comments
 (0)