Skip to content

Commit 79c7342

Browse files
committed
---
yaml --- r: 93694 b: refs/heads/try c: 74d2731 h: refs/heads/master v: v3
1 parent 0e8b450 commit 79c7342

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: 89a9ce0cc6ecd8c1369bede6916ef9e27bcc0ee8
5+
refs/heads/try: 74d27311a7ecb50b4783b6adc4a977a6e51759b2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/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)