make-wrapped-dict
Version: 4.2.1.5

wrap-dict

Jay McCarthy <jay at plt-scheme dot org>

A wrapper for dictionaries with limited datatype support

 (require (planet jaymccarthy/wrap-dict))

(make-wrapped-dict to-key    
  from-key    
  to-val    
  from-val)  (dict? . -> . dict?)
  to-key : (any/c . -> . any/c)
  from-key : (any/c . -> . any/c)
  to-val : (any/c . -> . any/c)
  from-val : (any/c . -> . any/c)

Returns a function that accepts a dictionary and returns a new dictionary with the same contents, except that whenever a key is requested it is projected with to-key and whenever a value is inserted it is projected with to-val. Similarly, whenever a key is returned it is projected with from-key and a value is projected with from-val.

This is useful if your dictionary only supports limited data types such as strings in which case to-key should write and from-key should read.