Skip to content

Instantly share code, notes, and snippets.

@death
Created June 26, 2020 12:34
Show Gist options
  • Save death/ba3220de533f5ccd2f64e246116d61bb to your computer and use it in GitHub Desktop.
Save death/ba3220de533f5ccd2f64e246116d61bb to your computer and use it in GitHub Desktop.
Find suspect symbols
(defun find-suspect-symbols (packages)
"Return a list of lists of suspect symbols present in PACKAGES.
A suspect symbol is a symbol that has a name that is equal to another
symbol in another package."
(let ((symbols-by-names (make-hash-table :test 'equal)))
(flet ((add-package (package)
(do-symbols (symbol package)
(pushnew symbol (gethash (symbol-name symbol) symbols-by-names '())))))
(dolist (package packages)
(add-package package))
(loop for symbols being each hash-value of symbols-by-names
when (cdr symbols)
collect symbols))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment