summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-06-04 11:36:17 +0200
committerRicardo Wurmus <rekado@elephly.net>2019-06-04 11:36:17 +0200
commit5dea867d3a035de87278e662687bfa32870465c9 (patch)
treed3889c9ad2e1eb38695f0833ce7aaaa8182b7255
parent30463ba2ea487bfeedc97d63e165ab77700b8b64 (diff)
compile: get-exported-symbols: Simplify.
* modules/language/python/compile.scm (get-exported-symbols): Simplify and add docstring.
-rw-r--r--modules/language/python/compile.scm21
1 files changed, 10 insertions, 11 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index 6c46ea1..4c07076 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -104,17 +104,16 @@
(if (not (equal? val 0))
(format #t "exit with error ~a~%" val))))))
-(define (get-exported-symbols x)
- (aif it (resolve-module x)
- (aif it (module-public-interface it)
- (let ((l '()))
- (module-for-each
- (lambda (k b)
- (set! l (cons k l)))
- it)
- l)
- '())
- '()))
+(define (get-exported-symbols name)
+ "Return a list of exported symbols from the module with the given
+NAME, a list of symbols. If the module does not exist return the
+empty list."
+ (or (and=> (and=> (resolve-module name) module-public-interface)
+ (lambda (interface)
+ (module-map (lambda (name var) name)
+ interface)))
+ '()))
+
(define cvalues (G 'values))