1 ;;; documentation.lisp --- Accessing DOCUMENTATION
3 ;;; APROPOS and friends
5 (defun map-apropos-symbols (function string package)
6 (flet ((handle-symbol (symbol)
7 ;; TODO: it's implementation-dependent, though CHAR-EQUAL seems
8 ;; more reasonable nevertheless
9 (when (search string (symbol-name symbol) :test #'char=)
10 (funcall function symbol))))
12 (do-symbols (symbol package) (handle-symbol symbol))
13 (do-all-symbols (symbol) (handle-symbol symbol)))))
15 (defun apropos-list (string &optional package)
19 (pushnew symbol symbols :test #'eq))
23 (defun apropos (string &optional package)
26 (format t "~S" symbol)
28 (format t " (bound)"))
29 (when (fboundp symbol)
30 (format t " (fbound)"))
36 ;; TODO: this needs DESCRIBE-OBJECT as generic method
37 ;; TODO: indentation for nested paragraphs
38 (defun describe (object &optional stream)
39 (declare (ignore stream))
42 (format t "~S~% [cons]~%" object))
44 (format t "~S~% [integer]~%" object))
46 (format t "~S~% [symbol]~%" object)
48 (format t "~%~A names a special variable:~% Value: ~A~%"
49 object (symbol-value object))
50 (let ((documentation (documentation object 'variable)))
52 (format t " Documentation:~%~A~%" documentation))))
53 (when (fboundp object)
54 (format t "~%~A names a function:~%" object)
55 (let ((documentation (documentation object 'function)))
57 (format t " Documentation:~%~A~%" documentation)))))
59 (format t "~S~% [string]~%~%Length: ~D~%"
60 object (length object)))
62 (format t "~S~% [float]~%" object))
64 (format t "~S~% [array]~%" object))
66 (format t "~S~% [function]~%" object)
67 (let ((documentation (documentation object 'function)))
69 (format t " Documentation:~%~A~%" documentation))))
71 (warn "~A not implemented yet for ~A" 'describe object)))