dir
de Python.(define (introspect #!optional symbol)
(if symbol
(let ((module-data (alist-ref symbol ##sys#module-table)))
(if module-data
(let-values (((_ module-symbols _) (##sys#module-exports module-data)))
(map car module-symbols))
(let loop ((syms (##sys#current-environment)))
(if (null? syms)
'()
(let* ((sym/sym+prefix (car syms))
(sym+prefix (symbol->string (cdr sym/sym+prefix)))
(tokens (string-split sym+prefix "#" #t))
(prefix (car tokens)))
(if (equal? (->string symbol) prefix)
(cons (string->symbol (string-intersperse (cdr tokens) ""))
(loop (cdr syms)))
(loop (cdr syms))))))))
(map car (##sys#current-environment))))
Exemplos de uso
$ csi -n
CHICKEN
(c)2008-2009 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.2.0 - SVN rev. 16023
linux-unix-gnu-x86 [ manyargs dload ptables applyhook ]
compiled 2009-10-20 on dellito (Linux)
#;1> ,l introspection.scm
; loading introspection.scm ...
#;1> (introspect)
()
#;2> (import html-utils)
; loading /usr/local/chicken-4.2.0/lib/chicken/4/html-utils.import.so ...
; loading /usr/local/chicken-4.2.0/lib/chicken/4/chicken.import.so ...
; loading /usr/local/chicken-4.2.0/lib/chicken/4/scheme.import.so ...
; loading /usr/local/chicken-4.2.0/lib/chicken/4/files.import.so ...
; loading /usr/local/chicken-4.2.0/lib/chicken/4/data-structures.import.so ...
; loading /usr/local/chicken-4.2.0/lib/chicken/4/srfi-13.import.so ...
; loading /usr/local/chicken-4.2.0/lib/chicken/4/posix.import.so ...
; loading /usr/local/chicken-4.2.0/lib/chicken/4/utils.import.so ...
; loading /usr/local/chicken-4.2.0/lib/chicken/4/html-tags.import.so ...
; loading /usr/local/chicken-4.2.0/lib/chicken/4/srfi-1.import.so ...
#;3> (introspect 'html-utils)
(tabularize itemize enumerate html-page combo-box hidden-input)
#;4> (introspect 'srfi-1)
(alist-cons alist-copy alist-delete alist-delete! any append! append-map append-map!
append-reverse append-reverse! assoc break break! car+cdr circular-list circular-list?
concatenate concatenate! cons* count delete delete! delete-duplicates delete-duplicates!
dotted-list? drop drop-right drop-right! drop-while eighth every fifth filter filter! filter-map
find find-tail first fold fold-right fourth iota last last-pair length+ list-copy list-index
list-tabulate list= lset-adjoin lset-diff+intersection lset-diff+intersection! lset-difference
lset-difference! lset-intersection lset-intersection! lset-union lset-union! lset-xor lset-xor!
lset<= lset= make-list map map! map-in-order member ninth not-pair? null-list? pair-fold
pair-fold-right pair-for-each partition partition! proper-list? reduce reduce-right remove
remove! reverse! second seventh sixth span span! split-at split-at! take take! take-right
take-while take-while! tenth third unfold unfold-right unzip1 unzip2 unzip3 unzip4 unzip5 xcons
zip)
Nenhum comentário:
Postar um comentário