Crates.io | aviary |
lib.rs | aviary |
version | 0.1.1 |
source | src |
created_at | 2017-10-21 16:08:56.686495 |
updated_at | 2017-10-21 16:13:59.481671 |
description | Aviary bird combinators for Rust. |
homepage | https://github.com/fwrs/aviary-rs |
repository | https://github.com/fwrs/aviary-rs |
max_upload_size | |
id | 36488 |
size | 27,039 |
Rust Aviary
This crate is a reimplementation of Haskell's Data.Aviary combinators in Rust.
Add the following to the [dependencies]
section of your Cargo.toml:
aviary = "0.1.0"
Available at docs.rs
Let's define some helper functions:
let eq = &(|x: String, y: String| PartialEq::eq(&x, &y)) as &Fn(String, String) -> bool;
let reverse = |x: String| x.chars().rev().collect::<String>();
And make a function using the starling combinator:
let is_palindrome = starling(&eq, &reverse);
Make sure our function is correct:
assert!(is_palindrome("nisumaa oli isäsi ilo aamusin".to_string()));
Any contributions are welcome.