Racket has a non-empty-listof
contract but no non-empty-hashof
contract. Is there a way to build one?
Predicates can be used as contracts, so:
(define (non-empty-hash? x)
(and (hash? x)
(not (hash-empty? x))))
Then you can use non-empty-hash?
as your contract.