| Crates.io | iter-rationals |
| lib.rs | iter-rationals |
| version | 0.2.1 |
| created_at | 2022-08-30 04:59:05.552233+00 |
| updated_at | 2023-03-08 23:52:41.751816+00 |
| description | A fixed size, linear time, no-std iterator over the rational numbers. |
| homepage | |
| repository | https://github.com/nathanielknight/iter-rationals |
| max_upload_size | |
| id | 654960 |
| size | 24,276 |
This crate implements an iterator over the rational numbers which:
The algorithm is described in Functional Pearl: Enumerating the Rationals by Gibbons, Lester, and Bird; see the paper for an explanation of how it works.
use iter_rationals::Rationals;
fn main() {
let rs = Rationals::<u32>::new();
for r in rs.take(20) {
println!("{r}");
}
}
Add this dependency to your Cargo.toml:
iter-rationals = "0.1"
or on the command line:
cargo add iter-rationals