by mcculley · 10y ago · 0 comments
http://www.lispworks.com/documentation/HyperSpec/Body/f_docu...
(defun test ()
"A test function"
(+ 1 1))
=> TEST
(documentation 'test 'function)
=> "A test function"
You can statically analyze source code to pull them out, or ask the Lisp image for them, etc. Is there something missing?I would like to see more structure: expected arguments, return type, etc.
A trivial example (your editor can do this for you):
(defun add-string (a b)
(declare (number a) (string b))
"Parses b and adds to a"
(+ a (parse-integer b)))
CL-USER> (describe #'add-string)
#<FUNCTION ADD-STRING>
[compiled function]
Lambda-list: (A B)
Derived type: (FUNCTION (NUMBER STRING) (VALUES NUMBER &OPTIONAL))
Documentation:
Parses b and adds to a
Source file: /home/bja/foo.lisp (declaim (ftype (function (number string) number) add-string))
(defun add-string (a b) ...)Are all of the standard functions documented this way?
If you mean structure within the docstrings, there's no official standard, but markup languages for that exist, see Codex[2].
[0]: http://clhs.lisp.se/Body/f_fn_lam.htm
https://github.com/bbatsov/emacs-lisp-style-guide#docstrings
Edited to add: Documentation strings actually predate Common Lisp. They were available at least as early as Zetalisp (mid-1970s).
Emacs, Guile, and the common lisp in this project have doc strings?
What implementations are you referring to, and what features do you think they're missing?