[funds-cvs] r180 - trunk/funds/src/trees

20 Aug
2007
20 Aug
'07
1:38 a.m.
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))))) +
6525
Age (days ago)
6525
Last active (days ago)
0 comments
1 participants
participants (1)
-
abaine@common-lisp.net