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

abaine at common-lisp.net abaine at common-lisp.net
Mon Aug 20 01:38:24 UTC 2007


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)))))
+



More information about the Funds-cvs mailing list