(rule, fns=basic_fns)
return chain(rule, lambda expr: sall(top_down(rule, fns), fns)(expr))
Apply a rule down a tree running it on the top nodes first
Apply a rule down a tree running it on the top nodes first
Apply a rule down a tree running it on the top nodes first
def top_down(rule, fns=basic_fns):
    """ Apply a rule down a tree running it on the top nodes first """
    return chain(rule, lambda expr: sall(top_down(rule, fns), fns)(expr))
def top_down ( rule , fns = basic_fns ) : return chain ( rule , lambda expr : sall ( top_down ( rule , fns ) , fns ) ( expr ) )