I think it's definitely time to have a dictionary typeclass, analogous to comparators; a record of procedures that specifies standard things to do to a dictionary. I'll have to figure out what it should provide, but definitely the core operations are make-dict, dict-ref, dict-size, dict-set (returns the updated dictionary even if that is unnecessary) and dict-for-each. In the interests of time, I'll make this two SRFIs, one for the core and one for other common ops, unlike the comparator SRFIs.
> (treplace map)
> Returns a transducer which uses any value as a key in map. If a
mapping is found, the value of that mapping is returned, otherwise it
just returns the original value.
> Must not keep any internal state. Modifying the map after treplace
has been instantiated is an error.
The "map" argument could be perhaps called "mapping" to distinguish it
from the word "map" used elsewhere in the SRFI for the usual procedure.
Likewise, use of word the "value" could be clarified since there two
kinds of values are being discussed: mapping values and transduction values.
The data type or interface of the mapping is not specified. The
implementation shows that it can be an association list or a hash-table,
and "assoc" / "hash-table-ref" are used for the lookup. That implies the
equality predicate is equal? for alist lookups and whatever predicate
the hash-table is using for ht lookups. SRFI 146 (Mappings) is not
referred to in the SRFI. It might be good to add an explicit
specification of all this stuff. Note that some Schemes have more than
one hash-table implementation. I'm not sure what is the best way to take
that into account. Perhaps specify something like "mapping is an
association list (using equal? to compare keys); a hash-table; or
another implementation-defined mapping object".