guile-docs/guile-docs/docs.scm

23 lines
657 B
Scheme

(use-modules (srfi srfi-9))
(define-record-type <doc>
(make-doc module symbol documentation)
doc?
(module doc-module)
(symbol doc-symbol)
(documentation doc-documentation))
(define (docs-in-module module)
"Returns a list of <doc> for each symbol in module mod"
(module-map
(lambda (sym var)
(let* ((binding (variable-ref var))
(proc (cond
((procedure? binding) binding)
((macro? binding) (macro-binding binding))
(else #f)))
(docs (when (procedure? proc) (procedure-documentation proc))))
(make-doc (module-name module) sym docs)))
module))