1lambda!(t = {x}x y);
2
3lambda!(f = {y}x y);
4
5lambda!(and = {x,(y,t,f),f } t f x y , t ,f );
6
7lambda!(or = {x,t,(y,t,f)} t f x y , t ,f );
8
9lambda!(not = {x,f,t}t f x , t, f);
10
11lambda!(if_else = {a,x,y}a x y );
12
13lambda!(xor = {if_else ,x ,(not,y),y} if_else not x y, if_else, not);
14
15
16
17#[cfg(test)]
18mod tests {
19 use crate::*;
20 #[test]
21 fn it_works() {
22 assert_eq!(lambda!(to_bool, t ) ,true);
23 assert_eq!(lambda!(to_bool, f ) ,false);
24 assert_eq!(lambda!(to_bool , and , t ,f ),false);
25 assert_eq!(lambda!(to_bool , or , t ,f ),true);
26 assert_eq!(lambda!(to_bool , xor , t, t),false);
27 assert_eq!(lambda!(to_bool , xor , f, t),true);
28 }
29}