[plt-scheme] hash-table question

From: Robby Findler (robby at cs.uchicago.edu)
Date: Fri Feb 4 10:36:55 EST 2005

At Fri, 4 Feb 2005 10:33:30 -0500, Larry White wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> is there a way to get at the values of a hash-table as a list?
> I have a need to access data sometimes using search, and sometimes
> iteratively.  I could implement search over the data held as a list,
> but it would be much less efficient.   Other languages have the
> equivilent of a function like (values my-hash-table) that would return
> a list of values.   Anything like that available?
> Since the hash-table-for-each and hash-table-map functions require a
> proc with exactly two procedures (key and value), they're not really
> useful for my situation.  I need to apply a four parameter function to
> each value.

I'm not entirely sure, but I'm guessing you can just write something
like this:

 (hash-table-map ht (lambda (x y) (four-arg-proc whatever whatever x y)))

Good luck.


Posted on the users mailing list.