shithub: femtolisp

ref: 7bcf6ac7b612306d197d063aaf6d971ca5dd2e3f
dir: /docs_extra.lsp/

View raw version
(define-macro (doc-for term doc)
  (let* ((sym     (or (and (cons? term) (car term)) term))
         (val     (top-level-value sym))
         (funvars (and (cons? term) (cdr term))))
    (if (not funvars)
        (when (function? val)
          (error "docs: " sym ": no funvars specified"))
        (unless (function? val)
          (error "docs: " sym ": funvars set but isn't a function")))
    (symbol-set-doc sym doc funvars)))

(doc-for (vm-stats)
  "Print various VM-related information, such as the number of GC calls
so far, heap and stack size, etc.")

(del! *syntax-environment* 'doc-for)