(rule, fns=basic_fns)
return all_rl
Strategic all - apply rule to args
Strategic all - apply rule to args
Strategic all - apply rule to args
def sall(rule, fns=basic_fns):
    """ Strategic all - apply rule to args """
    op, new, children, leaf = map(fns.get, ('op', 'new', 'children', 'leaf'))
    def all_rl(expr):
        if leaf(expr):
            return expr
        else:
            args = map(rule, children(expr))
            return new(op(expr), *args)
    return all_rl
def sall ( rule , fns = basic_fns ) : op , new , children , leaf = map ( fns . get , ( 'op' , 'new' , 'children' , 'leaf' ) ) def all_rl ( expr ) : if leaf ( expr ) : return expr else : args = map ( rule , children ( expr ) ) return new ( op ( expr ) , * args ) return all_rl