Macro lamcal::binds [−][src]
macro_rules! binds { ($($name:ident => $term:expr),* $(,)*) => { ... }; ($($name:expr => $term:expr),* $(,)*) => { ... }; }
Constructs a set of Binding
s from identifier to Term
.
The binds! macro can be used to conveniently construct multiple Binding
s.
The resulting set of bindings is returned as a std::collections::HashSet
.
Examples
This example creates a set of bindings.
#[macro_use] extern crate lamcal; use lamcal::combinator::{I, K}; use lamcal::environment::bind; use lamcal::{lam, var}; use std::collections::HashSet; let bindings = binds! { "I" => I(), "Hummingbird" => lam("a", lam("b", lam("c", app![var("a"), var("b"), var("c"), var("b")]))), "K" => K(), }; let mut expected = HashSet::new(); expected.insert(bind("I", lam("a", var("a")))); expected.insert(bind( "Hummingbird", lam( "a", lam("b", lam("c", app![var("a"), var("b"), var("c"), var("b")])), ), )); expected.insert(bind("K", lam("a", lam("b", var("a"))))); assert_eq!(bindings, expected);