Example #1
0
def make_fun1(name, rules, klass):
  fun = varcache(name)
  if len(rules)==0:
    return replace_def(fun, (), [[]], klass)
  if len(rules)==1:
    return replace_def(fun, preparse(rules[0][0]), preparse(rules[0][1]), klass)
  replaces = []
  for head, bodies in rules:
    head = preparse(head)
    bodies = preparse(bodies)
    replaces .append(replace_def(fun, head, bodies, klass))
  return special.begin(*replaces)  
Example #2
0
def make_fun1(name, rules, klass):
    fun = varcache(name)
    if len(rules) == 0:
        return replace_def(fun, (), [[]], klass)
    if len(rules) == 1:
        return replace_def(fun, preparse(rules[0][0]), preparse(rules[0][1]),
                           klass)
    replaces = []
    for head, bodies in rules:
        head = preparse(head)
        bodies = preparse(bodies)
        replaces.append(replace_def(fun, head, bodies, klass))
    return special.begin(*replaces)
Example #3
0
 def test2(self):
     eq_(preparse(fun.a(x)[prin(1)]),
         replace_def(a, (x, ), ((prin(1), ), ), UserFunction))
Example #4
0
 def test2(self):
   eq_(preparse(fun. a(x)[prin(1)]), replace_def(a, (x,), ((prin(1),),), UserFunction))