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

abaine at common-lisp.net abaine at common-lisp.net
Mon Aug 20 15:40:04 UTC 2007


Author: abaine
Date: Mon Aug 20 11:40:04 2007
New Revision: 187

Modified:
   trunk/funds/src/queue.lisp
Log:
Added queue-from-list.

Modified: trunk/funds/src/queue.lisp
==============================================================================
--- trunk/funds/src/queue.lisp	(original)
+++ trunk/funds/src/queue.lisp	Mon Aug 20 11:40:04 2007
@@ -59,3 +59,10 @@
 would be dequeued from the given queue."
   (mapcar #'cdr (sort (tree-as-alist (queue-heap q))
 		      #'< :key #'car)))
+
+(defun queue-from-list (list)
+  "A queue whose elements are in the same order as the given list."
+  (reduce #'(lambda (q n)
+	      (queue-enqueue q n))
+	  list 
+	  :initial-value (make-queue)))



More information about the Funds-cvs mailing list