summaryrefslogtreecommitdiff
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
commit7166e8e55900d1c3d7c45692c6121fb8a0920e16 (patch)
treebfc69d16559131d94331a68d1f4a3c26460751dd
parent4bbe14d551f06608a9df68b4270c5d8b3fc3eb97 (diff)
downloadgeiser-chez-7166e8e55900d1c3d7c45692c6121fb8a0920e16.tar.gz
geiser-chez-7166e8e55900d1c3d7c45692c6121fb8a0920e16.tar.bz2
Golfing.
-rw-r--r--scheme/guile/geiser/modules.scm17
1 files changed, 7 insertions, 10 deletions
diff --git a/scheme/guile/geiser/modules.scm b/scheme/guile/geiser/modules.scm
index e59bbd2..6f499dd 100644
--- a/scheme/guile/geiser/modules.scm
+++ b/scheme/guile/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)