@@ 141,6 141,12 @@ a #<variable e70f6
%module-public-interface #<variable 895a60 value: #<interface (guile-user) 882bd0>>
#+END_EXAMPLE
+To get a list of all variables from the module guile, use
+
+#+BEGIN_SRC scheme
+,in (guile) ,b
+#+END_SRC
+
To get a list of all imported modules, use ,import or ,use without arguments.
#+BEGIN_SRC scheme
@@ 154,6 160,69 @@ You can find more of these REPL-commands
,help all
#+END_SRC
+The easiest way, however, is activating readline and just hitting tab
+twice:
+
+#+BEGIN_SRC sh
+echo "(use-modules (ice-9 readline))(activate-readline)" >> ~/.guile
+#+END_SRC
+
+Essentially this:
+
+#+BEGIN_SRC scheme
+(module-map (λ (sym var) sym) (resolve-interface '(guile)))
+#+END_SRC
+
+and
+
+#+BEGIN_SRC scheme
+,use ; returns (guile-user)
+,in (guile-user) ,use ; returns module listing
+,in (guile) ,b ; returns the bindings
+,in ...
+#+END_SRC
+
+
+Essentially this:
+
+#+BEGIN_SRC scheme
+(map (λ (x) (cons (module-name x) (module-map (λ (sym var) sym) (resolve-interface (module-name x))))) (module-uses (resolve-module '(guile-user))))
+#+END_SRC
+
+To get a dir as in Python, you can use this:
+
+#+BEGIN_SRC scheme
+ (import (ice-9 optargs))
+ (import (oop goops))
+ (use-modules (texinfo reflection))
+
+ ; define basic dir
+ (define* (dir #:key (all? #f))
+ (if all?
+ (map (λ (x) (cons (module-name x)
+ (module-map (λ (sym var) sym) (resolve-interface (module-name x)))))
+ (module-uses (current-module)))
+ (module-map (λ (sym var) sym) (current-module))))
+ ; add support for giving the module as argument
+ (define-generic dir)
+ (define-method (dir (all? <boolean>)) (dir #:all? all?))
+ (define-method (dir (m <list>)) (module-map (λ (sym var) sym) (resolve-interface m)))
+ ; add support for using modules directly (interfaces are also modules, so this catches both)
+ (define-method (dir (m <module>)) (module-map (λ (sym var) sym) m))
+#+END_SRC
+
+You can use it this:
+
+#+BEGIN_SRC scheme
+(dir) ; all local bindings, excluding imported modules
+(dir #t) ; all available bindings, including imported modules
+(dir #:all? #t) ; same as above
+(dir '(ice-9 optargs)) ; all exported bindings from the (ice-9 optargs) module
+; => (let-optional* define* let-keywords let-keywords* define*-public defmacro* defmacro*-public let-optional lambda*)
+(dir (resolve-module '(ice-9 optargs)) ; all bindings in the module
+; => (let-optional* parse-lambda-case %module-public-interface let-keywords let-keywords* define*-public defmacro* defmacro*-public *uninitialized* let-optional vars&inits)
+#+END_SRC
+
** Publish a project cross-platform easily
No simple solution yet.