Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (13 sloc) 327 Bytes
// build-pass (FIXME(62277): could be check-pass?)
// ignore-emscripten no i128 support
fn fibs(n: u32) -> impl Iterator<Item=u128> {
(0 .. n)
.scan((0, 1), |st, _| {
*st = (st.1, st.0 + st.1);
Some(*st)
})
.map(&|(f, _)| f)
}
fn main() {
println!("{:?}", fibs(10).collect::<Vec<_>>());
}
You can’t perform that action at this time.