--- Entering Interactive Mode --- Parsed: \a.\b.a Parsed: \a.\b.b Parsed: \b.\x.\y.((b x) y) Parsed: \x.(x x) Parsed: (to_church 5) Parsed: \f.(\x.(f (x x)) \x.(f (x x))) Parsed: (fix \f.\n.(((id ((eq n) 0)) 1) ((mul n) (f ((sub n) 1))))) Parsed: \x.\y.\b.((b x) y) Parsed: \p.(p true) Parsed: \p.(p false) Parsed: ((pair 1) ((pair 3) 5)) Parsed: ((primpair 0) ((primpair 1) 2)) Parsed sub exp Parsed sub exp Parsed: (\a.(\b.((add a) b) 1) 0) (((if true) 0) 1) (((if false) 0) 1) (id true) (id false) (id id) ((id id) id) (id ((id id) id)) apply_self (id apply_self) (apply_self id) (apply_self apply_self) (\x.3 (apply_self apply_self)) (succ 1) (to_church 5) (depth (to_church 5)) (depth five) (\x.\b.(x b) 6) ((mul 7) 6) ((div 10) 2) ((add 6) 9) ((sub 10) 2) ((eq 7) 6) ((eq 7) 7) (factorial 5) (tl ((pair 3) 5)) (hd ((pair 3) 5)) (hd list_a) (tl list_a) (hd (tl list_a)) ((pair 0) 1) ((pair 0) ((pair 1) 2)) ((primpair 0) 1) (primhd list_a) (primtl list_a) subtest let subtest = (\a.(\b.((add a) b) 1) 0) let list_b = ((primpair 0) ((primpair 1) 2)) let list_a = ((pair 1) ((pair 3) 5)) let tl = \p.(p false) let hd = \p.(p true) let pair = \x.\y.\b.((b x) y) let factorial = (fix \f.\n.(((id ((eq n) 0)) 1) ((mul n) (f ((sub n) 1))))) let fix = \f.(\x.(f (x x)) \x.(f (x x))) let five = (to_church 5) let apply_self = \x.(x x) let if = \b.\x.\y.((b x) y) let false = \a.\b.b let true = \a.\b.a let id = \#0 Interpreting: (((if true) 0) 1) -> (((\\\((b x) y) \\a) 0) 1) Result: 0 Interpreting: (((if false) 0) 1) -> (((\\\((b x) y) \\b) 0) 1) Result: 1 Interpreting: (id true) -> (\#0 \\a) Result: \\a Interpreting: (id false) -> (\#0 \\b) Result: \\b Interpreting: (id id) -> (\#0 \#0) Result: \#0 Interpreting: ((id id) id) -> ((\#0 \#0) \#0) Result: \#0 Interpreting: (id ((id id) id)) -> (\#0 ((\#0 \#0) \#0)) Result: \#0 Interpreting: apply_self -> \(x x) Result: \(x x) Interpreting: (id apply_self) -> (\#0 \(x x)) Result: \(x x) Interpreting: (apply_self id) -> (\(x x) \#0) Result: \#0 Interpreting: (apply_self apply_self) -> (\(x x) \(x x)) TIMEOUT Interpreting: (\x.3 (apply_self apply_self)) -> (\3 (\(x x) \(x x))) Result: 3 Interpreting: (succ 1) -> (!succ 1) Result: 2 Interpreting: (to_church 5) -> (!to_church 5) Result: \\(#1 (#1 (#1 (#1 (#1 (#1 #0)))))) Interpreting: (depth (to_church 5)) -> (!depth (!to_church 5)) Result: 8 Interpreting: (depth five) -> (!depth (!to_church 5)) Result: 8 Interpreting: (\x.\b.(x b) 6) -> (\\(x b) 6) Result: \(6 b) Interpreting: ((mul 7) 6) -> ((!mul 7) 6) Result: 42 Interpreting: ((div 10) 2) -> ((!div 10) 2) Result: 5 Interpreting: ((add 6) 9) -> ((!add 6) 9) Result: 15 Interpreting: ((sub 10) 2) -> ((!sub 10) 2) Result: 8 Interpreting: ((eq 7) 6) -> ((!eq 7) 6) Result: \\#0 Interpreting: ((eq 7) 7) -> ((!eq 7) 7) Result: \\#1 Interpreting: (factorial 5) -> ((\(\(f (x x)) \(f (x x))) \\(((\#0 ((!eq n) 0)) 1) ((!mul n) (f ((!sub n) 1))))) 5) Result: 120 Interpreting: (tl ((pair 3) 5)) -> (\(p \\b) ((\\\((b x) y) 3) 5)) Result: 5 Interpreting: (hd ((pair 3) 5)) -> (\(p \\a) ((\\\((b x) y) 3) 5)) Result: 3 Interpreting: (hd list_a) -> (\(p \\a) ((\\\((b x) y) 1) ((\\\((b x) y) 3) 5))) Result: 1 Interpreting: (tl list_a) -> (\(p \\b) ((\\\((b x) y) 1) ((\\\((b x) y) 3) 5))) Result: \((b 3) 5) Interpreting: (hd (tl list_a)) -> (\(p \\a) (\(p \\b) ((\\\((b x) y) 1) ((\\\((b x) y) 3) 5)))) Result: 3 Interpreting: ((pair 0) 1) -> ((\\\((b x) y) 0) 1) Result: \((b 0) 1) Interpreting: ((pair 0) ((pair 1) 2)) -> ((\\\((b x) y) 0) ((\\\((b x) y) 1) 2)) Result: \((b 0) ((\\\((b x) y) 1) 2)) Interpreting: ((primpair 0) 1) -> ((!primpair 0) 1) Result: \((#0 0) 1) Interpreting: (primhd list_a) -> (!primhd ((\\\((b x) y) 1) ((\\\((b x) y) 3) 5))) Result: 1 Interpreting: (primtl list_a) -> (!primtl ((\\\((b x) y) 1) ((\\\((b x) y) 3) 5))) Result: \((b 3) 5) Interpreting: subtest -> (\(\((!add a) b) 1) 0) Result: 1