Method: (RUCKSACK-MAP-SLOT-INDEXES STANDARD-RUCKSACK T)

Source

(defmethod rucksack-map-slot-indexes ((rucksack standard-rucksack) function
                                      &key (class t) (include-subclasses t))
  (if (eql class t)
      (map-btree (slot-index-tables rucksack)
                 (lambda (class slot-index-table)
                   (map-btree slot-index-table
                              (lambda (slot slot-index)
                                (funcall function class slot slot-index)))))
    (let ((visited-p (make-hash-table)))
      (labels ((map-indexes (class)
                 (unless (gethash class visited-p)
                   (let ((slot-index-table (btree-search (slot-index-tables rucksack)
                                                         (class-name class)
                                                         :errorp nil)))
                     (when slot-index-table
                       (map-btree slot-index-table
                                  (lambda (slot slot-index)
                                    (funcall function (class-name class)
                                             slot
                                             slot-index)))))
                   (setf (gethash class visited-p) t)
                   (when include-subclasses
                     (mapc #'map-indexes
                           (class-direct-subclasses class))))))
        (map-indexes (if (symbolp class) (find-class class) class))))))
Source Context