Hi,
I am currently using hash tables a lot, so inevitably I end up writing
general functions. I wrote the following `hash-filter`:
```
(define (hash-filter
ht
#:predicate [predicate #f]
#:predicate/key [predicate/key
(if predicate
(λ (_ v) (predicate v))
(error 'hash-filter))])
(for/fold ([filtered-pairs (hash-clear ht)])
([(k v) (in-hash ht)])
(if (predicate/key k v)
(hash-set filtered-pairs k v)
filtered-pairs)))
```
Before I submit a pull request to the Racket repository, I would like to
know whether adding this function to `racket/hash` is a good idea, or
whether I should create a separate package with extra functions for hash
tables.
-
Sergiu
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/3c2618ed-8940-4234-9014-e65081eb961fn%40googlegroups.com.