Loose end: zip

Paul Sandoz paul.sandoz at oracle.com
Mon Jun 10 10:08:34 PDT 2013


On Jun 9, 2013, at 6:40 AM, Joe Bowbeer <joe.bowbeer at gmail.com> wrote:

> I have not used this zip, actually, and I just tried to use it and I was
> not pleased.
> 
> When I use zip, I'm usually pairing keys to items.  Usually the keys are
> ints and the items are some app-specific object, or maybe just a string:
> 
> zipped = zip(ints(), collection.stream());
> 
> *This* version of zip requires me to supply a third "zipper" argument,
> which means I also have to make up a type for the pairs.
> 

Yes, cause i did not want to add Pair :-) so I think this just adds to the argument this function it is not very helpful until the language has tuples.

Paul.


> What I really want is a zip that returns Stream<Pair<A,B>> so I don't have
> to deal with the pairing:
> 
> <A,B> Stream<Pair<A,B>> zip(Stream<? extends A> a, Stream<? extends B> b)
> 
> --Joe


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