示例#1
0
def make_expression(text):
  code = begin(
    sexpression_defines, 
    classic_defines, 
    set_text(text),
    from_(classic, program)(exp), 
    eoi,
    eval_(pycall(cons2tuple, exp)))
  return to_sexpression(code)
示例#2
0
文件: testeval.py 项目: charyorde/dao
 def test_let_in_module(self):
   a, m1, m2 = Var('a'), Var('m1'), Var('m2')
   eq_(eval(let([(m1,module(define(a,1), let([(a,2)], define(a,3))))], 
              from_(m1,a))), 1) 
示例#3
0
文件: testeval.py 项目: charyorde/dao
 def testfrom(self):
   a, m = Var('a'), Var('m')
   eq_(eval(let([(m,module(define(a,1)))], from_(m,a))), 1)
示例#4
0
文件: testeval.py 项目: charyorde/dao
 def test_embeded_module(self):
   a, m1, m2 = Var('a'), Var('m1'), Var('m2')
   eq_(eval(let([(m1,module(define(a,1),define(m2, module(define(a,2)))))], 
              from_(from_(m1,m2),a))), 2) 
示例#5
0
def from_sexp(var):
  return from_(sexpression_module, var)