APROPOS-LIST no longer returns duplicate symbols

This commit is contained in:
Juan Jose Garcia Ripoll 2012-06-30 09:03:04 +02:00
parent 1d3355d0db
commit 896e1e3ff1
2 changed files with 10 additions and 2 deletions

View file

@ -56,6 +56,8 @@ ECL 12.2.2:
etc, which correspond to the POSIX C constants INT_MAX, INT_MIN, LONG_MAX,
and similar ones.
- APROPOS-LIST no longer returns duplicate symbols.
* Windows:
- ECL guesses whether the input / output / error streams are consoles. If

View file

@ -156,16 +156,22 @@ PACKAGE is non-NIL, then only the specified PACKAGE is searched."
(mapc #'print-symbol-apropos (apropos-list string package))
(values))
(defun apropos-list (string &optional package)
"Args: (string &optional (package nil))
Returns a list of all symbols whose print-names contain STRING as substring.
If PACKAGE is non-NIL, then only the specified PACKAGE is searched."
(sort (delete-duplicates (apropos-list-inner string package))
#'(lambda (s1 s2)
(string-lessp (prin1-to-string s1)
(prin1-to-string s2)))))
(defun apropos-list-inner (string package)
(declare (si::c-local))
(let* ((list '())
(string (string string)))
(cond (package
(dolist (p (package-use-list package))
(setf list (nconc (apropos-list string p) list)))
(setf list (nconc (apropos-list-inner string p) list)))
(do-symbols (symbol package)
(when (search string (string symbol) :test #'char-equal)
(setq list (cons symbol list)))))