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

abaine at common-lisp.net abaine at common-lisp.net
Wed Jul 11 02:45:49 UTC 2007


Author: abaine
Date: Tue Jul 10 22:45:48 2007
New Revision: 77

Modified:
   trunk/funds/src/trees/constructors.lisp
Log:
make-leaf functions now all return singletons.

Modified: trunk/funds/src/trees/constructors.lisp
==============================================================================
--- trunk/funds/src/trees/constructors.lisp	(original)
+++ trunk/funds/src/trees/constructors.lisp	Tue Jul 10 22:45:48 2007
@@ -17,11 +17,18 @@
 
 (in-package :funds)
 
+(defconstant +bt-leaf+ (make-instance 'bt-leaf))
+(defconstant +avl-leaf+ (make-instance 'avl-leaf))
+(defconstant +heap-leaf+ (make-instance 'heap-leaf))
+
 (defun make-bt-leaf ()
-  (make-instance 'bt-leaf))
+  +bt-leaf+)
 
 (defun make-avl-leaf ()
-  (make-instance 'avl-leaf))
+  +avl-leaf+)
+
+(defun make-heap-leaf ()
+  +heap-leaf+)
 
 (defun make-binary-tree ()
   (make-bt-leaf))
@@ -37,8 +44,7 @@
 		     :height (parent-height left right))
       (make-avl-leaf)))
 
-(defun make-heap-leaf ()
-  (make-instance 'heap-leaf))
+
 
 (defun make-heap (&key (priority 0 p-p) value 
 		  (left (make-heap-leaf)) (right (make-heap-leaf)))



More information about the Funds-cvs mailing list