reciter

Crates.ioreciter
lib.rsreciter
version0.1.2
sourcesrc
created_at2018-11-10 18:19:19.794152
updated_at2018-11-10 18:46:33.238682
descriptionMacro that allows converting a recursive function into an Iterator, which uses a cache
homepage
repositoryhttps://gitlab.com/XBagon/reciter
max_upload_size
id95927
size20,047
XBagon (XBagon)

documentation

README

The #[reciter] attribute macro allows converting a recursive function into an Iterator, which uses a cache.

Example

#[reciter(cache = "auto", start = 1)]
fn factorial(n: usize) -> BigInt {
    if n == 1 {
        BigInt::from(1)
    } else {
        n * factorial(n - 1)
    }
}

fn main() {
    let fi = FactorialIterator::new();
    for (i, fac) in fi.enumerate().take(512) {
        println!("{}! = {}", i + 1, fac);
    }
}    

For more information look into the documentation or at the tests in the repository.

Commit count: 11

cargo fmt