[plt-scheme] idiomatic way to get keys and values

From: praimon (praimon at gmail.com)
Date: Sat Jan 2 01:27:07 EST 2010

(require (planet untyped/unlib/hash))

(let ([keys (hash-keys h)]
      [values (hash-values h)])
 ...body...)

...but keys and values are random lists, so may not
be what you're looking for.

regards,
praimon

On Fri, Jan 1, 2010 at 7:51 PM, Todd O'Bryan <toddobryan at gmail.com> wrote:
> If I have a hash table h, I can get the keys and values
>
> (let
>  ([keys (hash-map h (lambda (k v) k))]
>   [values (hash-map h (lambda (k v) v)])
>
> but that seems kind of klunky. Is there a more idiomatic way that I'm
> not thinking of?
>
> Todd
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.