[plt-scheme] Contract with keyword help

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Wed Dec 23 17:11:08 EST 2009

(define make-hash-with-vals
  (make-keyword-procedure
   (λ (kws kw-args . rest)
     (let ([h (make-hash)])
       (for ([kw kws] [val kw-args])
         (hash-set! h kw val))
       h))))

Can I write a more informative contract for this function than
(unconstrained-domain-> (hash/c keyword? any))?

> (make-hash-with-vals #:one 1 #:two 2)
#hash((#:one . 1) (#:two . 2))


Posted on the users mailing list.