Next: , Up: Module System Internals


36.3.1 Bindings Browsing

You can think of the module system's hierarchical namespace as analogous to that of a (modernish) filesystem. Whereas a filesystem has directories, subdirectores and files, the module system has modules, bindings resolving to nested modules, and bindings resolving to ordinary Scheme values. To browse this hierarchy, evaluate the form:

     (use-modules (ice-9 ls))

This provides several procedures that are roughly akin to the unixoid ls(1) command, hence the name.

— Scheme Procedure: local-definitions-in root names

Return a list of names defined locally in the named subdirectory of root.

— Scheme Procedure: definitions-in root names

Return a list of all names defined in the named subdirectory of root. The list includes all locally defined names as well as all names inherited from a member of a use-list.

— Scheme Procedure: ls [various-refs...]

With no arguments, return a list of definitions in the current module.

With just one argument, interpret that argument as the name of a subdirectory of the current module and return a list of names defined there.

With more than one argument, still compute subdirectory lists, but return a list:

          ((<subdir-name> . <names-defined-there>)
           (<subdir-name> . <names-defined-there>)
           ...)
— Scheme Procedure: lls [various-refs...]

Analogous to ls, but with local definitions only.

— Scheme Procedure: recursive-local-define name value

Define name to have value value. name is a list of symbols, the last one being the binding name and the all previous ones being elements of the module name.

[Some examples here would be nice. –ttn]