chickadee » tree-rewrite » rewrite-fold-tree

rewrite-fold-tree RULES F INITprocedure

Returns a procedure that takes in a list, and applies the given set of rewrite rules to the elements of the list. If a rule pattern matches, the values of INIT is replaced by the result of (F T INIT) where T is the rewritten term. If no rule matches a given element, and the element is a list, recursively invokes itself on all elements in the tail of that list, and the head of the list is left in place.