[elephant-cvs] CVS elephant/src/utils

ieslick ieslick at common-lisp.net
Fri Mar 30 17:45:42 UTC 2007


Update of /project/elephant/cvsroot/elephant/src/utils
In directory clnet:/tmp/cvs-serv16747/src/utils

Modified Files:
	convenience.lisp package.lisp 
Log Message:
Move utility to utilities, fix warning

--- /project/elephant/cvsroot/elephant/src/utils/convenience.lisp	2007/03/06 04:15:27	1.5
+++ /project/elephant/cvsroot/elephant/src/utils/convenience.lisp	2007/03/30 17:45:42	1.6
@@ -69,3 +69,12 @@
    make it a list if it's an atom"
   (if (listp elts) elts (list elts)))
 
+(defun remove-indexed-element-and-adjust (idx array)
+  "Remove element at idx and adjust the array to
+   reduce array length by one"
+  (let ((last (- (length array) 1)))
+    (do ((i idx (1+ i)))
+	((= i last) nil)
+      (progn
+	(setf (aref array i) (aref array (+ 1 i)))))
+    (adjust-array array last)))
--- /project/elephant/cvsroot/elephant/src/utils/package.lisp	2007/03/06 04:15:27	1.5
+++ /project/elephant/cvsroot/elephant/src/utils/package.lisp	2007/03/30 17:45:42	1.6
@@ -37,4 +37,5 @@
    #:aif
    #:awhen
    #:mklist
-   #:it))
+   #:it
+   #:remove-indexed-element-and-adjust))




More information about the Elephant-cvs mailing list