[funds-cvs] r130 - trunk/funds/src

abaine at common-lisp.net abaine at common-lisp.net
Fri Aug 10 22:15:27 UTC 2007


Author: abaine
Date: Fri Aug 10 18:15:27 2007
New Revision: 130

Modified:
   trunk/funds/src/f-array.lisp
Log:
Implemented make-f-array.

Modified: trunk/funds/src/f-array.lisp
==============================================================================
--- trunk/funds/src/f-array.lisp	(original)
+++ trunk/funds/src/f-array.lisp	Fri Aug 10 18:15:27 2007
@@ -2,7 +2,18 @@
 (in-package :funds)
 
 (defun make-f-array (size &key (initial-contents nil))
-  )
+  (let ((length (length initial-contents)))
+   (labels ((f (start end)
+	      (if (= start end) 
+		  (make-binary-tree)
+		  (let ((midpoint (floor (+ end start) 2)))
+		    (make-instance 'binary-tree 
+				   :key midpoint :value (if (< start length)
+							 (elt initial-contents midpoint)
+							 nil)
+				   :left (f start midpoint)
+				   :right (f (1+ midpoint) end))))))
+     (f 0 size))))
 
 (defun f-array-elt (array index)
   )



More information about the Funds-cvs mailing list