anchor.diff:           (name (class-name class))
            (slots (remove 'parent (mapcar #'closer-mop:slot-definition-name (closer-mop:class-slots class)))))
       (apply #'make-instance
  -           (intern (concat name "-PSTREAM") (symbol-package name))
  -           (loop :for slot :in slots
  -                 :if (slot-boundp pattern slot)
  -                   :append (list (make-keyword slot)
  -                                 (pattern-as-pstream (slot-value pattern slot)))))))
  -
  -(defmethod as-pstream :around ((pattern pattern))
  -  (let ((pstream (call-next-method)))
  -    (incf (slot-value pattern 'pstream-count))
  -    pstream))
  +           (intern (concat name '-pstream) (symbol-package name))
  +           (mapcan (fn (when (slot-boundp pattern _)
  +                         (list (make-keyword _)
  +                               (pattern-as-pstream (slot-value pattern _)))))
  +                   slots))))
   
   (defmethod as-pstream :around ((object t))
     (let ((pstream (call-next-method)))
  
positive.code:                               (slot-value object 'pstream-count)
                                0)
              source object))
      pstream))
  
  (defmethod as-pstream :around ((pstream pstream)) ;; prevent pstreams from being "re-converted" to pstreams
    pstream)
  
  (define-condition pstream-out-of-range () ((index :initarg :index :reader pstream-elt-index))
  
negative.code: (defmethod peek ((pattern pattern))
    (next (as-pstream pattern)))
  
  (defmethod next ((pstream pstream))
    ;; fallback method; patterns should override their pstream subclasses with their own behaviors
    nil)
  
  (defmethod next :around ((pstream pstream))
    (labels ((get-value-from-stack (pattern)
               (with-slots (number pattern-stack) pattern
                 (if pattern-stack
                     (let* ((popped (pop pattern-stack))
                            (nv (next popped)))
                       (if (eop-p nv)
                           (get-value-from-stack pattern)
                           (progn
                             (push popped pattern-stack)
                             nv)))
                     (prog1
                         (let ((res (call-next-method)))
                           (typecase res
                             (pattern
                              (if (typep pattern '(or function t-pstream))
                                  res
                                  (progn ;; if `next' returns a pattern, we push it to the pattern stack as a pstream
                                    (let ((pstr (as-pstream res)))
                                      (setf (slot-value pstr 'start-beat) (beat pattern))
                                      (push pstr pattern-stack))
                                    (get-value-from-stack pattern))))
                             (t res)))
                       (incf number))))))
      (with-slots (number history history-number future-number) pstream
  