[plt-scheme] hash-table question

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Fri Feb 4 10:43:55 EST 2005

--- Larry White <ljw1001 at gmail.com> 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?

You might find the recipes in the Cookbook handy:

   http://schemecookbook.org/Cookbook/HashChapter#Hashes

You could use, e.g. (untested):

  (define (hash-table->values-list table)
    (hash-table-map table
      (lambda (key value)
        value)))

> 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.

This makes me think you don't fully grasp the power of
closures.   Maybe this will help:

  http://schemecookbook.org/Cookbook/IdiomStaticVariables

(Amazingly, there is nothing on currying in the cookbook!)

HTH,
Noel

=====
Email: noelwelsh <at> yahoo <dot> com
AIM: noelhwelsh


		
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 



Posted on the users mailing list.