2012-04-23 02:25:14 -05:00
|
|
|
import iter::*;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let range = bind uint::range(0u, 1000u, _);
|
2012-04-23 02:54:27 -05:00
|
|
|
let filt = bind iter::filter(range, {|&&n: uint|
|
|
|
|
n % 3u != 0u && n % 5u != 0u }, _);
|
|
|
|
let sum = iter::foldl(filt, 0u) {|accum, &&n: uint| accum + n };
|
2012-04-23 02:25:14 -05:00
|
|
|
|
|
|
|
io::println(#fmt("%u", sum));
|
|
|
|
}
|