Esempio n. 1
0
 def test_letrec_fac(self):
     from util import m, n, fac
     eq_(
         eval(
             letrec([
                 (fac, lamda([n], if_(eq(n, 1), 1, mul(n, fac(sub(n, 1))))))
             ], fac(3))), 6)
Esempio n. 2
0
 def test_letrec_fac(self):
     from util import m, n
     fac = MacroVar('fac')
     eq_(
         eval(
             letrec([
                 (fac, macro([n], if_(eq(n, 1), 1, mul(n, fac(sub(n, 1))))))
             ], fac(3))), 6)
Esempio n. 3
0
 def test_letrec_fac(self):
   from util import m, n
   fac = MacroVar('fac')
   eq_(eval(letrec([(fac, macro([n], if_(eq(n,1), 1, mul(n, fac(sub(n, 1))))))],
                 fac(3))), 6)
Esempio n. 4
0
 def test_letrec_fac(self):
   from util import m, n, fac
   eq_(eval(letrec([(fac, lamda([n], if_(eq(n,1), 1, mul(n, fac(sub(n, 1))))))],
                 fac(3))), 6)