You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
brag/private/hash.rkt

20 lines
387 B
Racket

#lang racket/base
(require racket/contract/base)
(provide
(contract-out
[hash->immutable-hash (-> hash? (and/c hash? immutable?))]))
;@----------------------------------------------------------------------------------------------------
(define (hash->immutable-hash h)
(if (and (hash? h) (immutable? h))
h
(for/hash ([(k v) (in-hash h)])
(values k v))))