anchor.diff:     (future-number :initform 0 :documentation "The number of peeks into the future that have been made in the pstream. For example, if `peek' is used once, this would be 1. If `next' is called after that, future-number decreases back to 0.")
      (future-beat :initform 0 :documentation "The current beat including all future outputs (the `beat' slot does not include peeked outputs)."))
     (:documentation "\"Pattern stream\". Keeps track of the current state of a pattern in process of yielding its outputs."))
  +
  +(defmethod initialize-instance :before ((pstream pstream) &key)
  +  (with-slots (history) pstream
  +    (setf history (make-array *max-pattern-yield-length* :initial-element nil))))
  +
  +(defmethod initialize-instance :after ((pstream pstream) &key)
  +  (set-parents pstream))
   
   (defmethod print-object ((pstream pstream) stream)
     (with-slots (number) pstream
  
positive.code:                `(defun ,name ,(function-lambda-list slots)
                    ,documentation
                    ,@(when pre-init (list pre-init))
                    (set-parents
                     (make-instance ',name
                                    ,@(mapcan (fn (unless (state-slot-p _)
                                                    (list (make-keyword (car _)) (car _))))
                                              slots)))))
               (add-doc-to-defun (sexp)
                 (if (and (listp sexp)
                          (position (car sexp) (list 'defun 'defmacro))
  
negative.code:   "Get `*event*' if it's not nil, or get a fresh empty event."
    (or *event* (event)))
  
  (defparameter *patterns* (list)
    "List of the names of all defined pattern types.")
  
  (defmacro defpattern (name superclasses slots &key documentation defun)
    "Define a pattern. This macro automatically generates the pattern's class, its pstream class, and the function to create an instance of the pattern, and makes them external in the cl-patterns package.
  
  NAME is the name of the pattern. Typically a word or two that describes its function, prefixed with p.
  