Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defgeneric update-system-for-new-interesting-object-predicate
- (system interesting-set uninteresting-set)
- (:documentation "Update bookkeeping in SYSTEM to accomodate changes in INTERESTING-OBJECT-P.
- Both INTERESTING-SET and UNINTERESTING-SET can be a list of changed block statuses, or T if all known blocks should be reconsidered.
- This is likely one of the longest symbols you will ever type.")
- (:method ((system standard-system))
- (dolistit ((set-name interesting-set uninteresting-set)
- (old-table (system-uninteresting-blocks system)
- (system-interesting-blocks system))
- (new-table (system-interesting-blocks system)
- (system-uninteresting-blocks system))
- (interesting-value t nil))
- (etypecase set-name
- (list (dolist (item set-name)
- (let ((info (gethash item old-table)))
- (unless (null info)
- (remhash item old-table)
- (setf (gethash item new-table)
- info)))))
- ((eql t) (loop for item being the hash-keys of old-name
- for (version . channels) being the hash-values of old-name
- when (eql (interesting-object-p system item version channels) interesting-value)
- do (remhash item old-table)
- (setf (gethash item new-table)
- (cons version channels))))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement