Created
January 4, 2019 18:49
-
-
Save informatimago/ed244752d63a01e70f6d0f326b200b5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun function-names (fun) | |
" | |
RETURN: A list of function names fbound to the function FUN. | |
NOTE: We only scan symbols and (setf symbols). Functions could also | |
be bound to slots or to various other lisp objects. | |
" | |
(let ((names '())) | |
(dolist (pack (list-all-packages) (delete-duplicates names)) | |
(do-symbols (sym pack) | |
(when (and (fboundp sym) (eql fun (symbol-function sym))) | |
(push sym names)) | |
(let ((setter `(setf ,sym))) | |
(when (and (fboundp setter) (eql fun (fdefinition setter))) | |
(push setter names))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment