X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/5a40d8757c97e84838f4800f24732fd55009df12..d185dba5caad19127c443d847b6214e4aebcad08:/doc/list-exports.lisp diff --git a/doc/list-exports.lisp b/doc/list-exports.lisp index f4117df..c47a500 100755 --- a/doc/list-exports.lisp +++ b/doc/list-exports.lisp @@ -200,9 +200,17 @@ (find-symbol-homes paths package))) (defun best-package-name (package) - (car (sort (cons (package-name package) - (copy-list (package-nicknames package))) - #'< :key #'length))) + + ;; We pick the shortest one. Strangely, there's no `find minimal thing + ;; according to this valuation' function in Common Lisp. + (loop with best = (package-name package) + with best-length = (length best) + for name in (package-nicknames package) + for name-length = (length name) + when (< name-length best-length) + do (setf best name + best-length name-length) + finally (return best))) (defvar charbuf-size 0)