Merge pull request 'charli-branch' (#1) from charli-branch into main
Reviewed-on: #1
This commit is contained in:
commit
8efcd9bca3
|
@ -0,0 +1,24 @@
|
|||
(define-module (guile-docs docs)
|
||||
#:use-module (srfi srfi-9)
|
||||
#:export (docs-in-module))
|
||||
|
||||
(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))
|
Loading…
Reference in New Issue