blob: 83e561f1bca18efeded6fedcd021624f8a5d5417 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
(define-module (hnh module-introspection)
:use-module (srfi srfi-1)
:use-module (hnh util)
:export (unique-symbols
find-module-declaration
module-declaration?
))
(define (unique-symbols tree)
(uniq
(sort* (filter symbol? (flatten tree))
string<? symbol->string)))
(define (module-declaration? form)
(cond ((null? form) #f)
((not (pair? form)) #f)
(else (eq? 'define-module (car form)))))
(define (find-module-declaration forms)
(and=> (find module-declaration? forms)
cadr))
|