On Wed, 27 Jun 2012 02:23:07 -0400
Matthew Mondor <[email protected]> wrote:
> (defun apropos (string &optional package)
Alternate implementation:
(defun symbol-apropos-to-string (symbol)
(let ((out '()))
(macrolet ((push-string (string)
`(push ,string out)))
(push-string (prin1-to-string symbol))
(when (fboundp symbol)
(if (special-operator-p symbol)
(push-string " Special form")
(if (macro-function symbol)
(push-string " Macro")
(push-string " Function"))))
(when (boundp symbol)
(if (constantp symbol)
(push-string " Constant: ")
(push-string " has value: "))
(push-string (prin1-to-string (symbol-value symbol))))
(apply #'concatenate 'string (nreverse out)))))
(defun apropos (string &optional package)
"Args: (string &optional (package nil))
Prints those symbols whose print-names contain STRING as substring. If
PACKAGE is non-NIL, then only the specified PACKAGE is searched."
(setq string (string string))
(mapc #'(lambda (string)
(princ string)
(terpri))
(loop
with dupes = (sort (mapcar #'symbol-apropos-to-string
(apropos-list string package))
#'string-lessp)
for prec = nil then item
for item in dupes
unless (and prec (string-equal prec item)) collect item))
(values))
--
Matt
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ecls-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecls-list