eta_reduce/eta_reduce.rs
1use lamcalc::lambda;
2
3fn main() {
4 let mut exp = lambda!(a. b. c. f a b c);
5
6 eprintln!("exp = {}", exp);
7 assert!(exp
8 .into_abs()
9 .unwrap()
10 .1
11 .into_abs()
12 .unwrap()
13 .1
14 .is_eta_redex());
15
16 assert!(exp.into_abs().unwrap().1.into_abs().unwrap().1.eta_reduce());
17 eprintln!("exp = {}", exp);
18
19 assert!(exp.into_abs().unwrap().1.eta_reduce());
20 eprintln!("exp = {}", exp);
21
22 assert!(exp.eta_reduce());
23 eprintln!("exp = {}", exp);
24}