Changeset 3997 for branches/f4grobner
- Timestamp:
- 2016-05-30T21:22:49-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/priority-queue.lisp
r3993 r3997 37 37 (:documentation "Representa a priority queue.")) 38 38 39 (defmethod initialize-instance ((self priority-queue)39 (defmethod initialize-instance :after ((self priority-queue) 40 40 &key 41 41 (element-type 'fixnum) 42 42 (test #'<=) 43 43 (element-key #'identity)) 44 (with-slots (heap test) 44 (with-accessors ((heap priority-queue-heap) 45 (test-x priority-queue-test)) 45 46 self 46 47 (setf heap (make-heap :element-type element-type) 47 test #'(lambda (x y) (funcall test (funcall element-key y) (funcall element-key x))))))48 test-x #'(lambda (x y) (funcall test (funcall element-key y) (funcall element-key x)))))) 48 49 49 50 (defgeneric enqueue (self item) … … 51 52 (with-slots (heap test) 52 53 self 53 (heap-insert heap item test)))) 54 (heap-insert heap item test)) 55 self)) 54 56 55 57 (defgeneric dequeue (self)
Note:
See TracChangeset
for help on using the changeset viewer.