diff --git a/mapytex/calculus/core/tree.py b/mapytex/calculus/core/tree.py index 9f16103..20be43b 100644 --- a/mapytex/calculus/core/tree.py +++ b/mapytex/calculus/core/tree.py @@ -194,15 +194,27 @@ class Tree(object): ... ("*", (3, 4)), ... 2)) >>> t = Tree.from_nested_parenthesis(nested_par) + >>> print(t) + + + > * + | > 3 + | > 4 + > 2 + >>> print(t.map_leaf(lambda x:2*x)) + + + > * + | > 6 + | > 8 + > 4 """ try: - left_applied = self.left_value.apply(function) + left_applied = self.left_value.map_leaf(function) except AttributeError: left_applied = function(self.left_value) try: - right_applied = self.right_value.apply(function) + right_applied = self.right_value.map_leaf(function) except AttributeError: right_applied = function(self.right_value)