Skip to content

Instantly share code, notes, and snippets.

@ijp
Created December 1, 2011 20:12
Show Gist options
  • Save ijp/1419495 to your computer and use it in GitHub Desktop.
Save ijp/1419495 to your computer and use it in GitHub Desktop.
get a list of module exports
(define-module (module-exports)
#:export (module-exports)
#:use-module (ice-9 session))
(define (module-exports module-name)
(let ((new-module (resolve-module module-name)))
(apropos-fold (lambda (module name var data)
(if (eqv? module new-module)
(cons name data)
data))
'()
".*"
(apropos-fold-accessible new-module))))
;; scheme@(guile−user)> (module-exports '(srfi srfi-1))
;; $1 = (break! circular−list append−reverse remove lset−xor! member iota take−right reduce−right find map−in−order lset−adjoin fifth every proper−list? append−reverse! partition! lset−diff+intersection! non−negative−integer? drop−right unfold list−index lset−union sixth delete−duplicates circular−list? zip remove! delete! take! break unfold−right lset−intersection any1 seventh unzip5 delete−duplicates! dotted−list? unzip1 find−tail first check−arg drop−right! for−each append−map lset−difference eighth count alist−cons null−list? unzip2 take−while last delete split−at append−map! out−of−range lset−xor ninth fold alist−copy not−pair? unzip3 take−while! every1 split−at! map! any lset−diff+intersection tenth fold−right alist−delete wrong−type−arg %module−public−interface list−copy list= unzip4 drop−while length+ pair−for−each lset−union! car+cdr pair−fold alist−delete! second span xcons concatenate filter−map lset−intersection! take pair−fold−right lset<= third span! list−tabulate map concatenate! partition lset−difference! assoc drop reduce lset= fourth)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment