anchor.diff:  (in-package :sykobot)
  +
  +
  +;;; Limiting
  +;;; With 110 facts the size is 4467 bytes.
  +;;; Assuming linear growth (is this valid?) that's 40 bytes per fact.
  +;;; the average human knows 200k words (apparently)
  +;;; so limit this to 100k facts = 3.8mb ~
  +(defvar *max-facts-to-store* 100000)
  +(defvar *facts-to-remove* 1000)
  +(defvar *facts-write-interval* 5)
  +;;;;;;;;;;;;;;
   
   ;;; Facts
   (defcommand fact ("(\\S+)*" topic)
  
positive.code:           (cl-store:restore (facts-db bot)))))
  
  (defreply save-facts ((bot (proto 'sykobot)))
    (cl-store:store (facts bot) (facts-db bot)))
  
  (defreply set-fact ((bot (proto 'sykobot))
                      noun info)
    (setf (gethash noun (facts bot)) info))
  (defreply set-fact :after ((bot (proto 'sykobot))
                             noun info)
    (declare (ignore noun info))
  
negative.code:     (if hasp
          info
          (format nil "I know nothing about ~A" noun))))
  
  (defreply erase-some-facts ((bot (proto 'sykobot)))
    (send-msg bot "#sykosomatic" "deleting facts")
    (let ((keys (hash-table-keys (facts bot))))
      (dotimes (n *facts-to-remove*) ;;remove approximately *facts-to-remove* facts
        (remhash (random-elt keys) (facts bot)))))
  
  
  (defreply erase-all-facts ((bot (proto 'sykobot)))
    (clrhash (facts bot)))
  