recursively "freeze" the returned tree - instead of using lists to store

children, use tuples.
@yutingyw in python, if you have a tuple with single element, you need to have a comma at the end, otherwise it thinks parenthesis is there to separate out the expression within a formula.