[Openmcl-devel] ticket 159

Arthur W Cater arthur.cater at ucd.ie
Mon Mar 9 08:08:23 PDT 2009


Saw ticket 159 and was reminded of this snippet I use:

; ----------------------------------------------------------------------
; Handy APROPOSES macro
; ----------------------------------------------------------------------

(defmacro aproposes (&rest words)
  (let ((syms (gensym)) (fns (gensym)) (boundvars (gensym)) (others (gensym)))
    `(let* ((,syms (when ',words (reduce #'intersection (mapcar #'apropos-list ',words))))
            (,fns (remove-if-not #'fboundp ,syms))
            (,boundvars (remove-if-not #'boundp ,syms))
            (,others (remove-if #'(lambda (sym) (or (fboundp sym) (boundp sym))) ,syms)))
       (cond
        ((null ,syms)
         (format t "~&;; No such symbols found~%"))
        (t (when ,fns (format t "~&;; Functions:~%~s~%" ,fns))
           (when ,boundvars (format t "~&;; Bound variables:~%~s~%" ,boundvars))
           (when ,others (format t "~&;; Other symbols:~%~s~%" ,others))))
       (values))))


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20090309/ef05d3f4/attachment.htm>


More information about the Openmcl-devel mailing list