diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-06-17 02:10:09 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-06-17 02:10:09 +0200 |
commit | 7166e8e55900d1c3d7c45692c6121fb8a0920e16 (patch) | |
tree | bfc69d16559131d94331a68d1f4a3c26460751dd /scheme/guile/geiser/modules.scm | |
parent | 4bbe14d551f06608a9df68b4270c5d8b3fc3eb97 (diff) | |
download | geiser-chez-7166e8e55900d1c3d7c45692c6121fb8a0920e16.tar.gz geiser-chez-7166e8e55900d1c3d7c45692c6121fb8a0920e16.tar.bz2 |
Golfing.
Diffstat (limited to 'scheme/guile/geiser/modules.scm')
-rw-r--r-- | scheme/guile/geiser/modules.scm | 17 |
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) |