treplace definition Lassi Kortela (07 Oct 2019 15:35 UTC)
Re: treplace definition John Cowan (07 Oct 2019 16:02 UTC)
Re: treplace definition Linus Björnstam (08 Oct 2019 20:14 UTC)

Re: treplace definition Linus Björnstam 08 Oct 2019 20:14 UTC

Good feedback. Thank you. That will be changed before it goes final. I chose not to specify the data type as there are many different mappings in different schemes. Specifying better what it is in the reference implementation and what it could be in other implementations is even better.

--
  Linus Björnstam

On Mon, 7 Oct 2019, at 17:34, Lassi Kortela wrote:
>  > (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".
>