chickadee » integer-map » fxmapping-adjoin/combinator

fxmapping-adjoin/combinator fxmap proc k₁ obj₁ k₂ procedure

Similar to fxmapping-adjoin, except that duplicate associations are combined with proc, which is a procedure of type * * → *. proc is called on the new and old values (in that order) associated with a duplicated key and is expected to return a value for the key. For example, if fxmap contains the association (k, v₁), then the value of (fxmapping-adjoin/combinator fxmap f k v) will be a fxmapping with the association (k, (f k vv₂)).


 (fxmapping-adjoin/combinator (fxmapping 0 "geordi" 1 "reginald")
                              (lambda (_ last first)
                                (string-append first " " last))
                              0 "laforge"
                              1 "barclay"))
 ⇒ ((0 . "geordi laforge") (1 . "reginald barclay"))