summaryrefslogtreecommitdiff
path: root/geiser
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-06-17 02:10:09 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-06-17 02:10:09 +0200
commit5e2c87483a4f043377aa38269e26cb9fad969118 (patch)
tree0fd1ed810c89c13091f42951bc495326d722a187 /geiser
parent11c2d580e6983eb9ac3261ba39924b82d2938573 (diff)
downloadgeiser-guile-5e2c87483a4f043377aa38269e26cb9fad969118.tar.gz
geiser-guile-5e2c87483a4f043377aa38269e26cb9fad969118.tar.bz2
Golfing.
Diffstat (limited to 'geiser')
-rw-r--r--geiser/modules.scm17
1 files changed, 7 insertions, 10 deletions
diff --git a/geiser/modules.scm b/geiser/modules.scm
index e59bbd2..6f499dd 100644
--- a/geiser/modules.scm
+++ b/geiser/modules.scm
@@ -66,19 +66,16 @@
(submodules (resolve-module '() #f)))
(define (all-modules)
- (define (not-anon m) (not (string-match "^[(]#[{]" m)))
+ (define (maybe-name m)
+ (let ((name (format "~A" (module-name m))))
+ (and (not (string-match "^[(]#[{]" name)) name)))
(let* ((guile (resolve-module '(guile)))
(roots (remove (lambda (m) (eq? m guile)) (root-modules))))
(cons "(guile)"
- (filter not-anon
- (apply append
- (map (lambda (r)
- (map (lambda (m)
- (format "~A" (module-name m)))
- (all-child-modules r '())))
- roots))))))
-
-(define (all-child-modules mod seen)
+ (filter-map maybe-name
+ (apply append (map all-child-modules roots))))))
+
+(define* (all-child-modules mod #:optional (seen '()))
(let ((cs (filter (lambda (m) (not (member m seen))) (submodules mod))))
(fold (lambda (m all) (append (all-child-modules m all) all))
(list mod)