#!/usr/bin/env python3
class Thunk:
def __init__(self, func, *args):
self.func = func
self.args = args
def force(self):
return self.func(*self.args)
def fix(f):
return f(Thunk(fix, f))
@fix
def fact(f):
def fact_n(n):
if n == 0: return 1
else: return n * (f.force())(n-1)
return fact_n
print(fact(5))