1 ;;; documentation.lisp --- Accessing DOCUMENTATION
3 ;;; APROPOS and friends
5 (defun map-apropos-symbols (function string package external-only)
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))))
13 (do-external-symbols (symbol package) (handle-symbol symbol))
14 (do-symbols (symbol package) (handle-symbol symbol)))
16 (do-all-external-symbols (symbol) (handle-symbol symbol))
17 (do-all-symbols (symbol) (handle-symbol symbol))))))
19 (defun apropos-list (string &optional package external-only)
23 (pushnew symbol symbols :test #'eq))
24 string package external-only)
27 (defun apropos (string &optional package external-only)
30 (format t "~S" symbol)
32 (format t " (bound)"))
33 (when (fboundp symbol)
34 (format t " (fbound)"))
36 string package external-only))
40 ;; TODO: this needs DESCRIBE-OBJECT as generic method
41 ;; TODO: indentation for nested paragraphs
42 (defun describe (object &optional stream)
43 (declare (ignore stream))
46 (format t "~S~% [cons]~%" object))
48 (format t "~S~% [integer]~%" object))
50 (format t "~S~% [symbol]~%" object)
52 (format t "~%~A names a special variable:~% Value: ~A~%"
53 object (symbol-value object))
54 (let ((documentation (documentation object 'variable)))
56 (format t " Documentation:~%~A~%" documentation))))
57 (when (fboundp object)
58 (format t "~%~A names a function:~%" object)
59 (let ((documentation (documentation object 'function)))
61 (format t " Documentation:~%~A~%" documentation)))))
63 (format t "~S~% [string]~%~%Length: ~D~%"
64 object (length object)))
66 (format t "~S~% [float]~%" object))
68 (format t "~S~% [array]~%" object))
70 (format t "~S~% [function]~%" object)
71 (let ((documentation (documentation object 'function)))
73 (format t " Documentation:~%~A~%" documentation))))
75 (warn "~A not implemented yet for ~A" 'describe object)))