Combine the context with the results from subtrees
Combine the context with the results from subtrees
combine is used after recursively transforming the subtrees, to combine the multiple results into one result to use in the post operation. The order of the context is from left to right in the tree structure.
Combine is always invoked, even on a single element sublist or on an empty list. The tree argument is the current tree, before applying the recursive transformation. Same for the context argument, it is the current context at that transformation step. So combine can be used to apply some function to each tree element.
Transformer for any tree
This is our most general transformer for trees, it can be extended for specific needs by overriding the context type C and the result type R, along with the combine and transform methods.