On 22-Mar-09, at 8:52 AM, Eduardo Cavazos wrote:
Jose,
I just stumbled on this today. Returns a vector of all the defined symbols:
(##symbol-table)
Nope! The symbol table contains chains of symbols which hash to a given element of the symbol table. One of the fields of symbol objects points to the next symbol. So use something like this instead:
(define (symbol-table->list st)
(define (symbol-chain s syms) (let loop ((s s) (syms syms)) (if (symbol? s) (loop (##vector-ref s 2) (cons s syms)) syms)))
(let loop ((lst (vector->list st)) (syms '())) (if (pair? lst) (loop (cdr lst) (symbol-chain (car lst) syms)) (reverse syms))))
(define (interned-symbols) (symbol-table->list (##symbol-table)))
(pp (length (interned-symbols)))
Marc