anchor.diff:  (in-package :yason)
   
   (defvar *json-output*)
  +
  +(defparameter *default-indent* nil
  +  "Set to T or an numeric indentation width in order to have YASON
  +  indent its output by default.")
  +
  +(defparameter *default-indent-width* 2
  +  "Default indentation width for output if indentation is selected
  +  with no indentation width specified.")
   
   (defgeneric encode (object &optional stream)
   
  
positive.code: (defmethod encode ((object integer) &optional (stream *standard-output*))
    (princ object stream))
  
  (defun encode-key/value (key value stream)
    (encode key stream)
    (write-char #\: stream)
    (encode value stream))
  
  (defmethod encode ((object hash-table) &optional (stream *standard-output*))
    (write-char #\{ stream)
    (let (printed)
      (maphash (lambda (key value)
                 (if printed
                     (write-char #\, stream)
                     (setf printed t))
                 (encode-key/value key value stream))
               object))
    (write-char #\} stream)
    object)
  
  (defmethod encode ((object vector) &optional (stream *standard-output*))
    (write-char #\[ stream)
    (let (printed)
      (loop
        for value across object
        do (when printed
             (write-char #\, stream))
           (setf printed t)
           (encode value stream)))
    (write-char #\] stream)
    object)
  
  (defmethod encode ((object list) &optional (stream *standard-output*))
    (write-char #\[ stream)
    (let (printed)
      (dolist (value object)
        (if printed
            (write-char #\, stream)
            (setf printed t))
        (encode value stream)))
    (write-char #\] stream)
    object)
  
  (defun encode-symbol/value (symbol value stream)
    (let ((string (symbol-name symbol)))
      (encode-key/value string value stream)))
  
  (defun encode-alist (object &optional (stream *standard-output*))
    (loop initially (write-char #\{ stream)
          with printed = nil
          for (key . value) in object
          do (if printed
                 (write-char #\, stream)
                 (setf printed t))
             (encode-symbol/value key value stream)
          finally (write-char #\} stream)
                  (return object)))
  
  (defun encode-plist (object &optional (stream *standard-output*))
    (loop initially (write-char #\{ stream)
          with printed = nil
          for (key value . rest) on object by #'cddr
          do (if printed
                 (write-char #\, stream)
                 (setf printed t))
             (encode-symbol/value key value stream)
          finally (write-char #\} stream)
                  (return object)))
  
  (defmethod encode ((object (eql 'true)) &optional (stream *standard-output*))
    (write-string "true" stream)
  
negative.code: encoded using the ENCODE generic function, so they both must be of a
  type for which an ENCODE method is defined."
    (next-aggregate-element)
    (write-indentation *json-output*)
    (encode-key/value key value (output-stream *json-output*))
    value)
  
  