X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/3d1115c859f5f44f2ddb7f4b2fe8e7c43960f6b8..38b78e8763833fee8b41ecaf7586558e9b60d254:/src/utilities.lisp diff --git a/src/utilities.lisp b/src/utilities.lisp index b02fdf4..4935f8b 100644 --- a/src/utilities.lisp +++ b/src/utilities.lisp @@ -526,17 +526,21 @@ (cdddr neigh-record) best-path))))))) dead)) -(export '(inconsistent-merge-error merge-error-candidates)) +(export '(inconsistent-merge-error + merge-error-candidates merge-error-present-function)) (define-condition inconsistent-merge-error (error) ((candidates :initarg :candidates - :reader merge-error-candidates)) + :reader merge-error-candidates) + (present :initarg :present :initform #'identity + :reader merge-error-present-function)) (:documentation "Reports an inconsistency in the arguments passed to `merge-lists'.") (:report (lambda (condition stream) (format stream "Merge inconsistency: failed to decide between ~ ~{~#[~;~A~;~A and ~A~:;~ ~@{~A, ~#[~;and ~A~]~}~]~}" - (merge-error-candidates condition))))) + (mapcar (merge-error-present-function condition) + (merge-error-candidates condition)))))) (export 'merge-lists) (defun merge-lists (lists &key pick (test #'eql) (present #'identity)) @@ -593,7 +597,8 @@ candidates)) (winner (cond ((null leasts) (error 'inconsistent-merge-error - :candidates (mapcar present candidates))) + :candidates candidates + :present present)) ((null (cdr leasts)) (car leasts)) (pick