From 5dea867d3a035de87278e662687bfa32870465c9 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Tue, 4 Jun 2019 11:36:17 +0200 Subject: compile: get-exported-symbols: Simplify. * modules/language/python/compile.scm (get-exported-symbols): Simplify and add docstring. --- modules/language/python/compile.scm | 21 ++++++++++----------- 1 file 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)) -- cgit v1.2.3