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)
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)
def test2(self): eq_(preparse(fun.a(x)[prin(1)]), replace_def(a, (x, ), ((prin(1), ), ), UserFunction))
def test2(self): eq_(preparse(fun. a(x)[prin(1)]), replace_def(a, (x,), ((prin(1),),), UserFunction))