Author: abaine Date: Sun Aug 19 12:38:18 2007 New Revision: 167
Modified: trunk/funds/src/queue.lisp Log: Documented queue functions.
Modified: trunk/funds/src/queue.lisp ============================================================================== --- trunk/funds/src/queue.lisp (original) +++ trunk/funds/src/queue.lisp Sun Aug 19 12:38:18 2007 @@ -23,20 +23,25 @@ (heap (make-heap)))
(defun queue-first (q) + "The value at the head of the given queue." (heap-first (queue-heap q)))
(defun queue-enqueue (q item) + "The queue that results when the given item is equeued on the given queue." (make-queue :next-priority (1+ (queue-next-priority q)) :heap (heap-insert (queue-heap q) item (queue-next-priority q))))
(defun queue-dequeue (q) + "The queue that results when the first item is removed from the given queue." (if (queue-empty-p q) q (make-queue :next-priority (1- (queue-next-priority q)) :heap (heap-remove (queue-heap q)))))
(defun queue-size (q) + "The number of items in the given queue." (tree-weight (queue-heap q)))
(defun queue-empty-p (q) + "Whether the given queue does not contain any items." (tree-empty-p (queue-heap q)))