Panicz Maciej Godek <godek.mac...@gmail.com> writes: > On the other hand, there is no way (or I haven't found one) > to list the bound symbols explicitly. It seems tempting to > have a reflection function `module-symbols' or `environment-symbols' > that would return the names of bound symbols, > or to have functions like environment->list or module->list that > would return assoc lists mapping symbols to their values. Hmm, no, but you are able to get the "obarray" for the module which is a hash of symbols -> variables.
(define (hash-keys hash) (hash-fold (lambda (key val prev) (cons key prev)) '() hash)) (define (module-exports module) (hash-keys (module-obarray module))) scheme@(guile−user)> (module-exports (resolve-module '(pfds queues))) $20 = (queue−>list queue−empty−condition? enqueue &queue−empty queue−length make−queue rotate queue−l∧ dummy queue−l make−queue−empty−condition %module−public−interface list−>queue dequeue queue−empty? queue? queue %make−queue queue−r makeq) This lists _all_ the bindings, even the non-public ones. I'm sure there is a way to get only the public (exported) ones using the interfaces, but that is beyond my knowledge at the moment. -- Ian Price -- shift-reset.com "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled"