Source
(defun apropos-list* (string &key (fbound nil fbound-supplied-p)
(bound nil bound-supplied-p)
(package nil package-supplied-p)
(distance 0 distance-supplied-p))
(let ((symbols '()))
(do-all-symbols (sym)
(block collect-symbol
(when fbound-supplied-p
(when (xor fbound (fboundp sym))
(return-from collect-symbol)))
(when bound-supplied-p
(when (xor bound (boundp sym))
(return-from collect-symbol)))
(when package-supplied-p
(unless (eql package (symbol-package sym))
(return-from collect-symbol)))
(when distance-supplied-p
(unless (and
(<= (abs (- (length (symbol-name sym))
(length string)))
distance)
(<= (levenshtein-distance string (symbol-name sym))
distance))
(return-from collect-symbol)))
(when (not distance-supplied-p)
;; regular string= test
(unless (search string (symbol-name sym) :test #'char-equal)
(return-from collect-symbol)))
;; all the checks we wanted to perform passed.
(push sym symbols)))
symbols))
Source Context