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

20 Aug
2007
20 Aug
'07
3:40 p.m.
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)))
6527
Age (days ago)
6527
Last active (days ago)
0 comments
1 participants
participants (1)
-
abaine@common-lisp.net