flatMap (original) (raw)

Joe Bowbeer joe.bowbeer at gmail.com
Sun Jan 6 16:06:41 PST 2013


Regarding flatMap makeover,

I finally went through Donald's Java8 solutions for gs-collections-kata and the only thing that really confused me was flatMap, with its FlatMapper and its sink argument -- which is then used as the target for an (unordered?) forEach...

Regarding the discussion above, I'm not enamored with the mapMulti or the yield names.

  1. mapMulti: I think it's a disadvantage that mapMulti sounds like MultiMap. I'd rather a name that contained a term like "expand" or "explode" which describes the operation.

Suggestions:

mapExpand (I kind of like the cute false-symmetry with mapReduce...) mapFlatten

  1. yield: AFAIK, this term is only used in the JDK in the control sense, as in Thread.yield. I think we can find a better term to indicate what is meant here, which is more like produce or supply or send.

Suggestions:

transfer produce

--Joe

On Wed, Dec 19, 2012 at 11:44 AM, Remi Forax <forax at univ-mlv.fr> wrote:

On 12/19/2012 08:37 PM, Brian Goetz wrote:

I think we should not use the name 'yield' because it can be a keyword added later if we introduce coroutine, generator, etc.

I thought of that. Then I realized we already have "Thread.yield" among others in the libraries, so there's no reason to use a suboptimal name just to avoid using the y-word. Are you saying that yieldInto is actually a better name? Or are you just trying to avoid a possible collision? I like yieldInto, now there is perhaps a better name. Rémi



More information about the lambda-libs-spec-observers mailing list