2012-04-11 23:45:18 -05:00
|
|
|
fn add(&&x: float, &&y: uint) -> float { x + (y as float) }
|
|
|
|
|
|
|
|
fn main() {
|
2012-06-29 18:26:56 -05:00
|
|
|
assert [1u, 3u]/_.foldl(20f, add) == 24f;
|
|
|
|
assert []/_.foldl(20f, add) == 20f;
|
2012-04-11 23:45:18 -05:00
|
|
|
assert none.foldl(20f, add) == 20f;
|
|
|
|
assert some(1u).foldl(20f, add) == 21f;
|
|
|
|
assert some(2u).foldl(20f, add) == 22f;
|
2012-06-29 18:26:56 -05:00
|
|
|
}
|