1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use crate::{Expression, Abstraction};
impl<T> FnOnce<(T,)> for Expression
where T: Into<Expression> +
From<Expression>
{
type Output = Expression;
extern "rust-call" fn call_once(self, t: (T,)) -> Expression {
γ!({self},t.0.into())
}
}
#[cfg(test)]
mod tests {
#[test]
fn var() {
let one = abs!{f.abs!{x.app!(f,x)}};
assert_eq!(app!(x,{one}), var!(x)(1));
}
#[test]
fn abs() {
assert_eq!(5u64, abs!{x.x}(5).into());
}
#[test]
fn app() {
let zero = abs!{f.abs!{x.x}};
assert_eq!(app!(app!(a,b),{zero}), app!(a,b)(0));
}
}