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