[elephant-cvs] CVS elephant/src/utils

ieslick ieslick at common-lisp.net
Sat Feb 17 20:37:23 UTC 2007


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

Modified Files:
	convenience.lisp 
Log Message:
Bug fix in subsets function that shows up under SBCL

--- /project/elephant/cvsroot/elephant/src/utils/convenience.lisp	2007/02/14 04:38:56	1.1
+++ /project/elephant/cvsroot/elephant/src/utils/convenience.lisp	2007/02/17 20:37:23	1.2
@@ -15,10 +15,10 @@
 (defun subsets (size list)
   "Generate subsets of size n from the list; the last subset has 
    the remaining elements if size does not represent an equal division"
-  (let ((subsets nil))
-    (loop for elt in list 
+  (let ((subsets (cons nil nil)))
+    (loop for elt in list
 	  for i from 0 do
-       (when (= 0 (mod i size))
+       (when (and (= 0 (mod i size)) (car subsets))
 	 (setf (car subsets) (nreverse (car subsets)))
 	 (push nil subsets))
        (push elt (car subsets)))




More information about the Elephant-cvs mailing list