'map' method, proposal of method name change

Remi Forax forax at
Wed Aug 16 12:26:52 UTC 2017

On August 15, 2017 6:51:00 PM GMT+02:00, Jonathan Bluett-Duncan <jbluettduncan at> wrote:
>Hi Krunoslav,
>I think the reason the method was named `map` rather than `replaceWith`
>an equivalent name, is because `map` is a well-known name for this
>sort of *higher-order
>function*. The name itself has been around in functional programming
>languages like Haskell and Scala and programming models like MapReduce
>Thus it would make sense to me that the writers of ``
>it `map` to follow the Principle of least astonishment
>(Why was it named that way? I admit I do not know, but someone else may
>able to explain.)

the name comes from Lisp

>Hope this helps.
>Best regards,


>On 12 August 2017 at 03:36, Krunoslav Magazin <magazin9 at>
>> Hi. When using 'map' method my opinion is that
>> 'replaceWith' as method name would better describe what method do.
>> 'map' method is applied on input stream, returns output stream but
>> returned stream elements are return values from 'map' method Function
>> argument. We continue our work with output stream so mapping with
>> input stream have no meaning. Input stream is replaced with output
>> stream which elements are outputs of Function. After that point we
>> forgot about input stream.
>> Example of usage:
>> now - -> e+2)..        // read: map input stream with
>> output stream containing elements resulting from function (e -> e+2)
>> proposed - stream.replaceWith(e -> e+2).. // read: replace input
>> stream with output stream containing elements resulting from function
>> (e -> e+2)
>> With 'map' method number of elements is the same but we do not make
>> assumptions what passed Function will do (specialization) until the
>> moment we pass Function implementation as method argument..
>> I will appreciate any comments.
>> Best regards,
>> Krunoslav Magazin

Sent from my Android device with K-9 Mail. Please excuse my brevity.

More information about the core-libs-dev mailing list