Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.50 KB | None | 0 0
  1. (defgeneric update-system-for-new-interesting-object-predicate
  2.     (system interesting-set uninteresting-set)
  3.   (:documentation "Update bookkeeping in SYSTEM to accomodate changes in INTERESTING-OBJECT-P.
  4. Both INTERESTING-SET and UNINTERESTING-SET can be a list of changed block statuses, or T if all known blocks should be reconsidered.
  5. This is likely one of the longest symbols you will ever type.")
  6.   (:method ((system standard-system))
  7.     (dolistit ((set-name interesting-set uninteresting-set)
  8.                (old-table (system-uninteresting-blocks system)
  9.                           (system-interesting-blocks system))
  10.                (new-table (system-interesting-blocks system)
  11.                           (system-uninteresting-blocks system))
  12.                (interesting-value t nil))
  13.       (etypecase set-name
  14.         (list (dolist (item set-name)
  15.                 (let ((info (gethash item old-table)))
  16.                   (unless (null info)
  17.                     (remhash item old-table)
  18.                     (setf (gethash item new-table)
  19.                           info)))))
  20.         ((eql t) (loop for item being the hash-keys of old-name
  21.                        for (version . channels) being the hash-values of old-name
  22.                        when (eql (interesting-object-p system item version channels) interesting-value)
  23.                          do (remhash item old-table)
  24.                             (setf (gethash item new-table)
  25.                                   (cons version channels))))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement