- (loop (typesw (null (return nil)))
- (focus (car it)
- (typesw (eql-specializer
- (focus (eql-specializer-object it)
- (typesw (keyword
- (compare (string< left right)))
- (symbol
- (focus (package-name (symbol-package it))
- (compare (string< left right)))
- (compare (string< left right)))
- (t
- (focus (with-output-to-string (out)
- (prin1 it out)
- (write-char #\nul))
- (compare (string< left right)))))))
- (class
- (focus (class-name it)
- (focus (package-name (symbol-package it))
- (compare (string< left right)))
- (compare (string< left right))))
- (t
- (error "unexpected things"))))
- (update (cdr it)))))
+ ;; Iterate over the two lists. The cursors advance down the spine, and
+ ;; we focus on each car in turn.
+
+ (loop
+ (typesw (null (return nil)))
+ ;; If one list reaches the end, then it's lesser; if both, they're
+ ;; equal.
+
+ (focus (car it)
+ ;; Examine the two specializers at this position.
+
+ (typesw (eql-specializer
+ (focus (eql-specializer-object it)
+ ;; We found an `eql' specializer. Compare the objects.
+
+ (typesw (keyword
+ ;; Keywords compare by name.
+
+ (compare (string< left right)))
+
+ (symbol
+ ;; Symbols compare by package and name.
+
+ (focus (package-name (symbol-package it))
+ (compare (string< left right)))
+ (compare (string< left right)))
+
+ (t
+ ;; Compare two other objects by comparing their
+ ;; string representations.
+
+ (focus (with-output-to-string (out)
+ (prin1 it out)
+ (write-char #\nul))
+ (compare (string< left right)))))))
+
+ (class
+ ;; We found a class, Compare the class names.
+ (focus (class-name it)
+ (focus (package-name (symbol-package it))
+ (compare (string< left right)))
+ (compare (string< left right))))
+
+ (t
+ ;; We found some other kind of specializer that we don't
+ ;; understand.
+
+ (error "unexpected things"))))
+
+ ;; No joy with that pair of specializers: try the next.
+ (update (cdr it)))))