racket/collects/unstable/hash.rkt
Carl Eastlund e52fb81aac Renamed bindings from unstable/hash and unstable/debug that will clash
with subsequent adaptation of (planet cce/scheme) to collects/unstable.
These bindings are temporary, and will be replaced in the adaptation.
2010-06-06 19:57:15 -04:00

14 lines
328 B
Racket

#lang racket/base
(provide simple-hash-union)
;; map map (key val val -> val) -> map
(define (simple-hash-union h1 h2 f)
(for/fold ([h* h1])
([(k v2) h2])
(let* ([v1 (hash-ref h1 k #f)]
[new-val (if v1
(f k v1 v2)
v2)])
(hash-set h* k new-val))))