type-nats.rs

Type-level natural numbers in Rust

build status

Synopsis

This library implements type-level natural numbers using traits and associated types. At this stage it is meant to serve as a demonstration more than anything else.

Examples

rust fn example() { let _: Answer< S<S<S<S<S<Z>>>>> > = Add::< S<S<S<Z>>> , S<S<Z>> >::query(); let _: Answer< N06 > = Mul::< N03 , N02 >::query(); let _: Answer< N08 > = Exp::< N03 , N02 >::query(); let _: Answer< N24 > = Fac::< N04 >::query(); }

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.