Source
Prelude
- let fix f = f (fix f)
fact = fix $ \ f n -> if n == 0 then 1 else n * f (n - 1)
in fact 4
- let fix f = f (fix f)
fact = fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
in fact 4
- let fix f = f (fix f)
fact
= (\ f n -> if n == 0 then 1 else n * f (n - 1))
(fix (\ f n -> if n == 0 then 1 else n * f (n - 1)))
in fact 4
- let fix f = f (fix f)
fact
= \ n ->
if n == 0 then 1 else
n * fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (n - 1)
in fact 4
- let fix f = f (fix f) in
(\ n ->
if n == 0 then 1 else
n * fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (n - 1))
4
- let fix f = f (fix f) in
if 4 == 0 then 1 else
4 * fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1)
- let fix f = f (fix f) in
if False then 1 else
4 * fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1)
- let fix f = f (fix f) in
4 * fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1)
- let fix f = f (fix f) in
4 *
(\ f n -> if n == 0 then 1 else n * f (n - 1))
(fix (\ f n -> if n == 0 then 1 else n * f (n - 1)))
(4 - 1)
- let fix f = f (fix f) in
4 *
if 4 - 1 == 0 then 1 else
(4 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1 - 1)
- let fix f = f (fix f) in
4 *
if 3 == 0 then 1 else
(4 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1 - 1)
- let fix f = f (fix f) in
4 *
if False then 1 else
(4 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1 - 1)
- let fix f = f (fix f) in
4 *
((4 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1 - 1))
- let fix f = f (fix f) in
4 *
(3 *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1 - 1))
- let fix f = f (fix f) in
4 *
(3 *
(\ f n -> if n == 0 then 1 else n * f (n - 1))
(fix (\ f n -> if n == 0 then 1 else n * f (n - 1)))
(4 - 1 - 1))
- let fix f = f (fix f) in
4 *
(3 *
if 4 - 1 - 1 == 0 then 1 else
(4 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1 - 1 - 1))
- let fix f = f (fix f) in
4 *
(3 *
if 3 - 1 == 0 then 1 else
(4 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1 - 1 - 1))
- let fix f = f (fix f) in
4 *
(3 *
if 2 == 0 then 1 else
(4 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1 - 1 - 1))
- let fix f = f (fix f) in
4 *
(3 *
if False then 1 else
(4 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1)) (4 - 1 - 1 - 1))
- let fix f = f (fix f) in
4 *
(3 *
((4 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1)))
- let fix f = f (fix f) in
4 *
(3 *
((3 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1)))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1)))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
(\ f n -> if n == 0 then 1 else n * f (n - 1))
(fix (\ f n -> if n == 0 then 1 else n * f (n - 1)))
(4 - 1 - 1 - 1)))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
if 4 - 1 - 1 - 1 == 0 then 1 else
(4 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1)))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
if 3 - 1 - 1 == 0 then 1 else
(4 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1)))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
if 2 - 1 == 0 then 1 else
(4 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1)))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
if 1 == 0 then 1 else
(4 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1)))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
if False then 1 else
(4 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1)))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
((4 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1))))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
((3 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1))))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
((2 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1))))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
(1 *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1))))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
(1 *
(\ f n -> if n == 0 then 1 else n * f (n - 1))
(fix (\ f n -> if n == 0 then 1 else n * f (n - 1)))
(4 - 1 - 1 - 1 - 1))))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
(1 *
if 4 - 1 - 1 - 1 - 1 == 0 then 1 else
(4 - 1 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1 - 1))))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
(1 *
if 3 - 1 - 1 - 1 == 0 then 1 else
(4 - 1 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1 - 1))))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
(1 *
if 2 - 1 - 1 == 0 then 1 else
(4 - 1 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1 - 1))))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
(1 *
if 1 - 1 == 0 then 1 else
(4 - 1 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1 - 1))))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
(1 *
if 0 == 0 then 1 else
(4 - 1 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1 - 1))))
- let fix f = f (fix f) in
4 *
(3 *
(2 *
(1 *
if True then 1 else
(4 - 1 - 1 - 1 - 1) *
fix (\ f n -> if n == 0 then 1 else n * f (n - 1))
(4 - 1 - 1 - 1 - 1 - 1))))
- 4 * (3 * (2 * (1 * 1)))
- 4 * (3 * (2 * 1))
- 4 * (3 * 2)
- 4 * 6
- 24