anchor.diff:                 :documentation "How many other other inhabitants that each inhabitant can see."))
     (:documentation "A town with a spatial delay. Inhabitants are only able to see their popularities with reference to a subset of the population."))
   
  -;; Structs are easy but they still need a bit of tweaking.
  -(defmethod hipsterish-tendency ((object inhabitant)) (inhabitant-hipsterish-tendency object))
  -(defmethod (setf hipsterish-tendency) (value (object inhabitant) ) (setf (inhabitant-hipsterish-tendency object) value))
  -(defmethod styles ((object inhabitant)) (inhabitant-style object))
  -(defmethod (setf styles) (value (object inhabitant)) (setf (inhabitant-style object) value))
  -
   ;;; Class constructors
   
   (defun generate-random-town (population styles volatile)
     "Generates a random town of n people with the given vector of styles."
     (let ((out (make-array (list population) :adjustable volatile)))
       (dotimes (i population)
  -      (setf (aref out i) (make-inhabitant :style (aref styles (random (length styles))))))
  +      (setf (aref out i) (make-instance 'inhabitant :style (aref styles (random (length styles))))))
       out))
                  
   (defun make-town (population &key (hipsterish-tendency 2/3) (styles #(#\# #\.)) volatile)
  
positive.code: ;;; When seeing the development of the town, we need to repeat things a lot.
  (defmacro with-town-iterator ((var town &key (times 20) (tick-time :before) copyp) &body body)
    "Creates a loop that evolves a town, allowing the user to do something for each generation of the town. Can be made nondestructive by passing non-nil to copyp."
    `(let ((,var ,(if copyp `(copy-town ,town) town)))
       (assert (typep ,var 'town-snapshot))
       (assert (typep ,tick-time '(member :before :after)))
       (loop repeat ,times
  
negative.code:                                               ;; Copying multidimensional arrays = ugh.
                                                for i from 0 below (period town)
                                                do (loop for j from 0 below (length (population town))
                                                         do (setf (aref history i j) (copy (aref (town-history town) i j))))
                                                finally (return history))))
    (:method ((town foggy-town))
      (Make-instance 'foggy-town
                     :visibility          (visibility town)
                     :hipsterish-tendency (hipsterish-tendency town)
                     :styles              (styles town)
                     :population          (map 'vector #'copy (population town))
                     :time                (ticks town)))
    (:method ((town inhabitant))
      (make-instance 'inhabitant
                     :hipsterish-tendency (hipsterish-tendency town)
                     :style               (styles town)
                     :type                (inhabitant-type town))))
  
  ;;; Other methods
  
  