From rneeser at common-lisp.net Sat Sep 4 14:00:58 2010 From: rneeser at common-lisp.net (Rudy Neeser) Date: Sat, 04 Sep 2010 10:00:58 -0400 Subject: [Cl-heap-cvs] r13 - cl-heap/tags/release-0.1.4 Message-ID: Author: rneeser Date: Sat Sep 4 10:00:58 2010 New Revision: 13 Log: Version 0.1.4 committed. Converts type specialisers from FIXNUM to INTEGER. Added: cl-heap/tags/release-0.1.4/ - copied from r12, /cl-heap/trunk/ Modified: cl-heap/tags/release-0.1.4/ChangeLog cl-heap/tags/release-0.1.4/binary-heap.lisp cl-heap/tags/release-0.1.4/cl-heap.asd Modified: cl-heap/tags/release-0.1.4/ChangeLog ============================================================================== --- /cl-heap/trunk/ChangeLog (original) +++ cl-heap/tags/release-0.1.4/ChangeLog Sat Sep 4 10:00:58 2010 @@ -1,3 +1,11 @@ +2010-09-04 Rudy Neeser + + * binary-heap.lisp (children-positions, parent-position) + (percolate-down, percolate-up, decrease-key, delete-from-heap): + Changed the specialising class for various index arguments to + these functions from FIXNUM to INTEGER in order to increase + portabilty. + 2010-03-17 Rudy Neeser * cl-heap-tests.asd: Added a new system definition file to run the Modified: cl-heap/tags/release-0.1.4/binary-heap.lisp ============================================================================== --- /cl-heap/trunk/binary-heap.lisp (original) +++ cl-heap/tags/release-0.1.4/binary-heap.lisp Sat Sep 4 10:00:58 2010 @@ -41,14 +41,14 @@ (declaim (inline children-positions)) (defun children-positions (position) - (declare (type fixnum position)) + (declare (type integer position)) (check-type position (integer 0 *)) (values (1+ (* position 2)) (+ 2 (* position 2)))) (declaim (inline parent-position)) (defun parent-position (position) - (declare (type fixnum position)) + (declare (type integer position)) (check-type position (integer 0 *)) (values (floor (/ (1- position) 2)))) @@ -56,7 +56,7 @@ (:documentation "Used to move a value in the DATA array of a BINARY-HEAP down the parent-child relationship hierarchy, and so preserve heap-ordering.") - (:method ((heap binary-heap) (position fixnum)) + (:method ((heap binary-heap) (position integer)) (with-slots (data) heap (labels ((choose-one (lhs rhs) ;; Of two nodes, returns the "least" @@ -88,7 +88,7 @@ (percolate-down heap chosen)))))))) (defgeneric percolate-up (heap position) - (:method ((heap binary-heap) (position fixnum)) + (:method ((heap binary-heap) (position integer)) (with-slots (data) heap (cond ((and (/= position 0) @@ -205,7 +205,7 @@ do (percolate-down first position)))) first))) -(defmethod decrease-key ((heap binary-heap) (item-index fixnum) value) +(defmethod decrease-key ((heap binary-heap) (item-index integer) value) "Deceases the key of the item pointed to by ITEM-INDEX. The index is returned as the second value of ADD-TO-HEAP. The value of the item at the index is changed to VALUE, which should be less than its old @@ -235,7 +235,7 @@ (percolate-up heap item-index)) heap) -(defmethod delete-from-heap ((heap binary-heap) (item-index fixnum)) +(defmethod delete-from-heap ((heap binary-heap) (item-index integer)) "Deltes an item from the heap. ITEM-INDEX is an index representing the value to remove, and is the second value returned from ADD-TO-HEAP. Note that running most HEAP functions can modify which Modified: cl-heap/tags/release-0.1.4/cl-heap.asd ============================================================================== --- /cl-heap/trunk/cl-heap.asd (original) +++ cl-heap/tags/release-0.1.4/cl-heap.asd Sat Sep 4 10:00:58 2010 @@ -27,7 +27,7 @@ (defsystem :cl-heap :description "An implementation of heap and priority queue data structures." - :version "0.1.3" + :version "0.1.4" :author "Rudy Neeser " :license "GPLv3" :serial t From rneeser at common-lisp.net Sat Sep 4 14:22:45 2010 From: rneeser at common-lisp.net (Rudy Neeser) Date: Sat, 04 Sep 2010 10:22:45 -0400 Subject: [Cl-heap-cvs] r14 - cl-heap/trunk Message-ID: Author: rneeser Date: Sat Sep 4 10:22:45 2010 New Revision: 14 Log: Added missing files. Modified: cl-heap/trunk/ChangeLog cl-heap/trunk/binary-heap.lisp cl-heap/trunk/cl-heap.asd Modified: cl-heap/trunk/ChangeLog ============================================================================== --- cl-heap/trunk/ChangeLog (original) +++ cl-heap/trunk/ChangeLog Sat Sep 4 10:22:45 2010 @@ -1,3 +1,11 @@ +2010-09-04 Rudy Neeser + + * binary-heap.lisp (children-positions, parent-position) + (percolate-down, percolate-up, decrease-key, delete-from-heap): + Changed the specialising class for various index arguments to + these functions from FIXNUM to INTEGER in order to increase + portabilty. + 2010-03-17 Rudy Neeser * cl-heap-tests.asd: Added a new system definition file to run the Modified: cl-heap/trunk/binary-heap.lisp ============================================================================== --- cl-heap/trunk/binary-heap.lisp (original) +++ cl-heap/trunk/binary-heap.lisp Sat Sep 4 10:22:45 2010 @@ -41,14 +41,14 @@ (declaim (inline children-positions)) (defun children-positions (position) - (declare (type fixnum position)) + (declare (type integer position)) (check-type position (integer 0 *)) (values (1+ (* position 2)) (+ 2 (* position 2)))) (declaim (inline parent-position)) (defun parent-position (position) - (declare (type fixnum position)) + (declare (type integer position)) (check-type position (integer 0 *)) (values (floor (/ (1- position) 2)))) @@ -56,7 +56,7 @@ (:documentation "Used to move a value in the DATA array of a BINARY-HEAP down the parent-child relationship hierarchy, and so preserve heap-ordering.") - (:method ((heap binary-heap) (position fixnum)) + (:method ((heap binary-heap) (position integer)) (with-slots (data) heap (labels ((choose-one (lhs rhs) ;; Of two nodes, returns the "least" @@ -88,7 +88,7 @@ (percolate-down heap chosen)))))))) (defgeneric percolate-up (heap position) - (:method ((heap binary-heap) (position fixnum)) + (:method ((heap binary-heap) (position integer)) (with-slots (data) heap (cond ((and (/= position 0) @@ -205,7 +205,7 @@ do (percolate-down first position)))) first))) -(defmethod decrease-key ((heap binary-heap) (item-index fixnum) value) +(defmethod decrease-key ((heap binary-heap) (item-index integer) value) "Deceases the key of the item pointed to by ITEM-INDEX. The index is returned as the second value of ADD-TO-HEAP. The value of the item at the index is changed to VALUE, which should be less than its old @@ -235,7 +235,7 @@ (percolate-up heap item-index)) heap) -(defmethod delete-from-heap ((heap binary-heap) (item-index fixnum)) +(defmethod delete-from-heap ((heap binary-heap) (item-index integer)) "Deltes an item from the heap. ITEM-INDEX is an index representing the value to remove, and is the second value returned from ADD-TO-HEAP. Note that running most HEAP functions can modify which Modified: cl-heap/trunk/cl-heap.asd ============================================================================== --- cl-heap/trunk/cl-heap.asd (original) +++ cl-heap/trunk/cl-heap.asd Sat Sep 4 10:22:45 2010 @@ -27,7 +27,7 @@ (defsystem :cl-heap :description "An implementation of heap and priority queue data structures." - :version "0.1.3" + :version "0.1.4" :author "Rudy Neeser " :license "GPLv3" :serial t