Author: abaine Date: Sun Aug 19 21:38:24 2007 New Revision: 180
Modified: trunk/funds/src/trees/utilities.lisp Log: Added map-tree.
Modified: trunk/funds/src/trees/utilities.lisp ============================================================================== --- trunk/funds/src/trees/utilities.lisp (original) +++ trunk/funds/src/trees/utilities.lisp Sun Aug 19 21:38:24 2007 @@ -16,3 +16,12 @@ 1 0) (tree-count-if predicate (bt-right tree) :key key)))) + +(defun map-tree (function tree) + (if (tree-empty-p tree) + tree + (stitch-tree tree + :value (funcall function tree) + :left (map-tree function (bt-left tree)) + :right (map-tree function (bt-right tree))))) +