anchor.diff:  ; compare-fun: For comparison tests, the function object that was used.
   ; raw-test: The form that was evaluated to produce this test.
   
  -; print-test-list: (listof structured-test) symbol -> string
  -; purpose: prints and returns a test report from the list of tests passed in, using
  -; structured-test-list->tap.
   (defun print-test-list (test-result-list &optional (print-test-plan 'after))
  +"print-test-list: (listof structured-test) symbol -> string
  +purpose: prints and returns a test report from the list of tests passed in, using structured-test-list->tap."
     (let ((result-string (structured-test-list->tap test-result-list print-test-plan)))
       (format T "~a" result-string)
       result-string))
   
  -; structured-test-list->tap: (listof structured-test) symbol -> string
  -; purpose: produces a test report from the list of tests passed in. The report is in the TAP
  -; (Test Anything Protocol) format.
  -; print-test-plan is whether to print the test plan (1..n), and if so when to print it:
  -; NIL: don't print any test plan
  -; 'before: print the test plan before printing a list of tests
  -; 'after: print the test plan after printing a list of test
   (defun structured-test-list->tap (test-result-list &optional (print-test-plan NIL))
  +  "structured-test-list->tap: (listof structured-test) symbol -> string
  +purpose: produces a test report from the list of tests passed in. The report is in the TAP (Test Anything Protocol) format. print-test-plan is whether to print the test plan (1..n), and if so when to print it:
  +  NIL: don't print any test plan
  +  'before: print the test plan before printing a list of tests
  +  'after: print the test plan after printing a list of test"
     (format NIL "~a~%~{~&~a~}~%~a"
       (if (eql print-test-plan 'before) (format NIL "1..~a" (length test-result-list)) "")
       (loop for test-result in test-result-list 
   	  collecting (structured-test->tap test-result))
       (if (eql print-test-plan 'after) (format NIL "1..~a" (length test-result-list)) "")))
   
  -; structured-test->tap: structured-test -> string
  -; prupose: produces a string containing a part of a report on the test passed in, in the
  -; TAP (Test Anything Protocol) format.
   (defun structured-test->tap (test-result)
  +"structured-test->tap: structured-test -> string
  +purpose: produces a string containing a part of a report on the test passed in, in the TAP (Test Anything Protocol) format."
     (let ((diagnostic-text (get-diagnostic-text test-result)))
       (format NIL "~:[not ok~;ok~] ~a~a~a~a~a"
         (getf test-result :test-passed)
  
positive.code:       (if (plist-contains-p test-result :compare-fun)
          (format NIL "compare-fun: ~S" (getf test-result :compare-fun)))))))
  
  ; start-all-lines-with-whitespace: string -> string
  ; purpose: produces a string equal to the initial string, but with each line beginning with
  ; at least 2 spaces before the first non-whitespace character. Additional spaces are prefixed
  ; to each line as necessary to ensure that there are at least 2 spaces before the first non-
  ; whitespace character on each line. Lines containing no non-whitespace characters still get
  ; the whitespace prefix.
  (defun start-all-lines-with-whitespace (input-text &key (always-add-whitespace NIL))
    (format NIL "~{~a~^~%~}"
  	  (map 'list (lambda (line)
  		       (start-line-with-whitespace line 2 :always-add-whitespace always-add-whitespace)) (split-sequence:split-sequence #\Newline input-text))))
    
  ; start-line-with-whitespace: string nat -> string
  ; purpose: produces a string equal to the input string, with at least whitespace-quantity
  ; whitespace characters preceding the first non-whitespace character. Additional spaces are
  ; prefixed if necessary to ensure that there are at least whitespace-quantity leading space
  ; characters in the string. Lines containing no non-whitespace characters still get the
  ; whitespace prefix.
  (defun start-line-with-whitespace (input-text whitespace-quantity &key (always-add-whitespace NIL))
    (cond
      ((<= whitespace-quantity 0) input-text)
      ((and
  
negative.code: 						     (- whitespace-quantity 1)
  						     :always-add-whitespace always-add-whitespace)))))
  
  (defun starts-with-whitespace-p (input-text)
    "starts-with-whitespace-p: string -> bool
  purpose: produces T if the input string starts with a space, otherwise produces NIL"
    (cond
      ((eql (length input-text) 0) NIL)
      ((char= (elt input-text 0) #\Space) T)
      (T NIL)))
  
  (defun plist-contains-p (input-plist desired-key)
    "plist-contains-p: plist any -> bool
  purpose: produces T if the input plist contains a key matching the second parameter, otherwise produces NIL."
    (loop for plist-key in input-plist by #'cddr do (when (eql plist-key desired-key) (return-from plist-contains-p T)))
    NIL)
  
  (defvar *report-test-index* 0)
  (defun next-test-index ()
    "next-report-index: -> nat
  purpose: produces the next unusued test number and increments the global counter."
    (setf *report-test-index* (+ 1 *report-test-index*))
    *report-test-index*)
  
  (defun print-test-plan ()
    "print-test-plan: -> string
  purpose: prints and returns the test plan string in the TAP format."
    (let ((result (get-test-plan)))
      (format T result)
      result))
  
  (defun get-test-plan ()
    "get-test-plan: -> string
  purpose: returns the test plan string in the TAP format."
    (format NIL "1..~a" *report-test-index*))
  