(defmacro (defdoc term . doc) «Define documentation for a top level term. Useful in cases where the documentation for a term has to be set independent of the definition of said term, or an additional form with the same name has to be documented. If `term` is a function signature and `doc` is not specified, just the signature will be included in the documentation, without replacing any previously defined. First `doc` argument is supposed to be a string with the description of the term. The following arguments are expected to be optional tag pairings that provide grouping for multiple symbols (`:doc-group`), "see also" references (`:doc-see`) and code examples (`:doc-example`). Custom formatting lambda (`:doc-fmt`) may be used to process the documentation string when it's printed with `(help ...)`. It's used by `defstruct` to provide full constructor description in the output.» :doc-example «(defdoc (func arg (arg2 0)) «Return something about the `arg` and `arg2`. This is a short description. This is the longer description, following the short one.\» :doc-example «(func 0) ; ↳ T\» :doc-example «(func 1 3) ; ↳ NIL\» :doc-group stuff :doc-see func2 :doc-fmt (λ (doc) doc) (defdoc (func arg (:another-variant NIL)))» :doc-group doc (let* {[call (cons? term)] [sym (or (and call (car term)) term)] [callvars (and call (cdr term))] [doc (car (separate-doc-from-body (append doc '(NIL))))]} (if call `(set-doc! ',sym ',doc ',callvars) `(set-doc! ',sym ',doc)))) (defmacro (doc-group group-name doc) «Define documentation for a group.» :doc-group doc `(begin (set-doc! (list 'doc 'group ',group-name) ,doc))) (doc-group doc «Writing and reading documentation.») (load "../src/docs/array.sl") (load "../src/docs/compress.sl") (load "../src/docs/debug.sl") (load "../src/docs/io.sl") (load "../src/docs/list.sl") (load "../src/docs/misc.sl") (load "../src/docs/number.sl") (load "../src/docs/ops.sl") (load "../src/docs/process.sl") (load "../src/docs/random.sl") (load "../src/docs/seq.sl") (load "../src/docs/string.sl") (load "../src/docs/struct.sl") (load "../src/docs/sys.sl") (load "../src/docs/table.sl") (load "../src/docs/time.sl") (load "../src/docs/type.sl") (load "../src/docs/vm.sl")