Dear All,

In the s-7 documentation, it says that a hash-table is a vector of alists
and can be iterated over by vector-ref.

In the following code (vector-ref table 1) throws a wrong-type-arg and I
cannot figure out how to iterate over the table:

---------------------------

(define (entropy list)
   (let ((table (make-hash-table)))
    (loop for e in list
          do (if (table e)
               (set! (table e) (+ (table e) 1))
               (begin (set! (table e) 1))))
     (vector-ref table 1)
    ))

(entropy '(0 1 0 0 1 0))

--------------------

Any help will be much appreciated.

Best,

Mike
_______________________________________________
Cmdist mailing list
[email protected]
http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to