anchor.diff:        (call-next-method)))
   
   ;;; Handle empty shapes.
  -(defmethod lazy-rehape ((lazy-array lazy-array)
  -                        (null null)
  -                        (transformation transformation))
  +(defmethod lazy-rehape
  +    ((lazy-array lazy-array)
  +     (null null)
  +     (transformation transformation))
     (empty-array))
  -
  -;;; Default:  Construct a new reference.
  -(defmethod lazy-rehape ((lazy-array lazy-array)
  -                        (shape shape)
  -                        (transformation transformation))
  -  (make-instance 'lazy-rehape
  -    :ntype (element-ntype lazy-array)
  -    :inputs (list lazy-array)
  -    :shape shape
  -    :transformation transformation))
   
   ;;; Error handling.
   (defmethod lazy-rehape :before
  
positive.code:     transformation)))
  
  ;;; Optimization:  Drop references with no effect.
  (defmethod lazy-rehape ((lazy-array lazy-array)
                          (shape shape)
                          (identity-transformation identity-transformation))
    (if (and (shape-equal (shape lazy-array) shape)
             ;; Don't drop references to range immediates.  The reason for
             ;; this is that we never want these immediates to appear as
  
negative.code:                  (subshapep relevant-shape input-shape))
        (error "~@<Invalid reference to ~S with shape ~S and transformation ~S.~:@>"
               lazy-array shape transformation))))
  
  ;;; Default:  Construct a new reference.
  (defmethod lazy-rehape ((lazy-array lazy-array)
                          (shape shape)
                          (transformation transformation))
    (make-instance 'lazy-rehape
      :ntype (element-ntype lazy-array)
      :inputs (list lazy-array)
      :shape shape
      :transformation (add-transformation-constraints shape transformation)))
  
  (defun add-transformation-constraints (shape transformation)
    (if (loop for range in (shape-ranges shape)
              for mask-entry across (transformation-input-mask transformation)
              never (and (size-one-range-p range)
                         (not mask-entry)))
        transformation
        (let ((input-mask (copy-seq (transformation-input-mask transformation))))
          (loop for range in (shape-ranges shape)
                for index from 0
                when (size-one-range-p range)
                  do (setf (aref input-mask index)
                           (range-start range)))
          (compose-transformations
           transformation
           (make-transformation :input-mask input-mask)))))
  
  