morphism 0.0.1

A structure for suspended closure composition in Rust
docs.rs failed to build morphism-0.0.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: morphism-0.4.1

morphism.rs

A structure for suspended closure composition in Rust

build status

Example

let mut fm: Morphism<uint, uint> = Morphism::new();
for _ in range(0u, 100000u) {
    fm = fm.push(|:x| x + 42u);
}
let mut gm: Morphism<uint, uint> = Morphism::new();
for _ in range(0u, 100000u) {
    gm = gm.push(|:x| x - 42u);
}
let gm = gm
    .push(|:x| Some(x))
    .push(|:x| x.map(|y| y + 42u))
    .push(|:x| x.map(|y| y.to_string()));
assert_eq!(fm.then(gm).run(0u), Some(String::from_str("42")));

Documentation

See the API documentation here.

Requirements

  1. Rust
  2. Cargo

You can install both with the following:

$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh

See Installing Rust for further details.

Usage

$ cargo build       ## build library and binary
$ cargo test        ## run tests in ./tests
$ cargo bench       ## run benchmarks in ./benches

Discussion

There is an IRC channel on freenode (chat.freenode.net) at #epsilonz.