Lazy sequence generation in Rust
Rust does have generators, but they are highly experimental and not currently available in stable Rust. Works in stable Rust 1.0 and above Range handles your concrete example. You can use it with the syntactical sugar of ..: fn main() { let sum: u64 = (0..1_000_000).sum(); println!(“{}”, sum) } What if Range didn’t exist? We … Read more