This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: hash-table-for-each, hash-table-map


Mikael Djurfeldt <mdj@nada.kth.se> writes:

> (define (hash-table-map proc ht)
>   (map (lambda (p)
>           (proc (car p) (cdr p)))
>        (apply append! (vector->list ht))))

Should of course be:

(define (hash-table-map proc ht)
  (apply append!
         (map (lambda (buckets)
                 (map (lambda (p)
                        (proc (car p) (cdr p)))
                      buckets))
              (vector->list ht))))

otherwise the hash table will be messed up!

/mdj