Jose,
It was earlier suggested that we should have a function like this.
Could you please have a look at it,
I would have to implement the Stream version of it (I may ask for
guidance as I have worked with it before).
>
https://github.com/eksperimental/experimental_elixir/blob/master/lib/enum_pad.ex
>
https://github.com/eksperimental/experimental_elixir/blob/master/test/enum_pad_test.exs
cheers.
On Wed, 13 Apr 2016 08:46:10 +0700
eksperimental <
eksper...@autistici.org> wrote:
> I asked a while ago if there was a zip-padding function,
>
https://groups.google.com/d/msg/elixir-lang-talk/pil9caRXQnM/-newc1hUAAAJ
> and there was not, and José suggested that that would be a desirable
> function to have in Enum, which I did... It's been there siting for a
> while and I was actually thinking about taking back on this week, to
> see that there is a similar proposal.
>
> It's already a working version,
>
https://github.com/eksperimental/experimental_elixir/blob/master/lib/enum_pad.ex
>
https://github.com/eksperimental/experimental_elixir/blob/master/test/enum_pad_test.exs
>
> what I ended up doing was creating two sets of functions:
> Enum.pad/3-4
> Enum.pad_zip/3-4
>
> and Enum.enumerable?/1 to determine if we are dealing with an
> enumerable (there are probably better ways to deal with this).
>
> I never submitted it because I never implemented the Stream versions
> of them, but whatever is under Enum is ready for review.
>
>
> On Tue, 12 Apr 2016 23:19:49 +0000
> Peter Hamilton <
petergh...@gmail.com> wrote:
>
> > Here are the options I see:
> > 1. zip/3 now and then when we split chunk/4 (breaking change) we can
> > also split zip/3.
> > 2. zip_pad (or whatever we call it) now, leave chunk/4 until a
> > breaking change release and do chunk_pad.
> > 3. do zip_pad and chunk_pad now and get them in the next breaking
> > change release.
> >
> > The long term goal (which I think we all agree on) should be
> > mirroring. There's a possible concession of a short term mismatch.
> > My preference is for this functionality to be available sooner
> > rather than later, so I wouldn't want to tie it to the release of
> > chunk_pad unless there was a breaking release coming. That leaves
> > #1 and #2. We've talked about #1 plenty, but it's probably fair to
> > say we shouldn't rule out #2 until we get a feel for what the new
> > semantics would be like.
> >
> > I'm having a hard time envisioning the split. What did you have in
> > mind?
> >
> > On Tue, Apr 12, 2016 at 2:43 PM José Valim
> > <
jose....@plataformatec.com.br> wrote:
> >
> > > Should we just introduce zip/3 or should we go with a more
> > > explicit name? I am aware mirroring chunk/4 is beneficial but I
> > > always felt chunk/4 could have been more intuitive as two
> > > separate functions.
> > >
> > > On Tuesday, April 12, 2016, Peter Hamilton
> > > <
petergh...@gmail.com> wrote:
> > >
> > >> Jose: Any notion of pad vs cycle should apply to chunk as well. I
> > >> think so long as we have chunk/4 in its current state, zip/3
> > >> should have the same behavior. I don't think we want to change
> > >> chunk at this point in time, so I think we're stuck with those
> > >> semantics.
> > >>
> > >> On Tue, Apr 12, 2016 at 2:28 PM Quentin Crain <
czr...@gmail.com>
> > >> wrote:
> > >>
> > >>> Yes, lovely!
> > >>>
> > >>> On Tue, Apr 12, 2016, 14:09 Peter Hamilton <> wrote:
> > >>>
> > >>>> Yes. With the case:
> > >>>>
> > >>>> zip(1..8, 1..5, Stream.cycle(["Marcia"]))
> > >>>> [{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, "Marcia"}, {7,
> > >>>> "Marcia"}, {8, "Marcia"}]
> > >>>>
> > >>>> also being true (important that the pad goes to whichever
> > >>>> stream ends first)
> > >>>>
> > >>>> 4}, {5, 5}]
> > >>>>>
> > >>>>> zip(1..5, 1..8, ["Marcia"])
> > >>>>> [{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {"Marcia", 6}]
> > >>>>>
> > >>>>> zip(1..5, 1..8, Stream.cycle(["Marcia"]))
> > >>>>> [{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {"Marcia", 6},
> > >>>>> {"Marcia", 7}, {"Marcia", 8}]
> > >>>>>
> > >>>>> No? (Assuming I'm understanding.)
> > >>>>>
> > >>>>> << q
> > >>>>>
> > >>>>> --
> > >>> You received this message because you are subscribed to the
> > >>> Google Groups "elixir-lang-talk" group.
> > >>> To unsubscribe from this group and stop receiving emails from
> > >>> it, send an email to
> > >>>
elixir-lang-ta...@googlegroups.com. To view this
> > >>> discussion on the web visit
> > >>>
https://groups.google.com/d/msgid/elixir-lang-talk/CALNYqAsQs%2Bjg9JCV3c5a%3DtR3uwdQ8rtj%3DM3wb%3D-%3DNuDOUOEg4Q%40mail.gmail.com
> > >>> <
https://groups.google.com/d/msgid/elixir-lang-talk/CALNYqAsQs%2Bjg9JCV3c5a%3DtR3uwdQ8rtj%3DM3wb%3D-%3DNuDOUOEg4Q%40mail.gmail.com?utm_medium=email&utm_source=footer> .
> > >>> For more options, visit
https://groups.google.com/d/optout.
> > >>>
> > >> --
> > >> You received this message because you are subscribed to the
> > >> Google Groups "elixir-lang-talk" group.
> > >> To unsubscribe from this group and stop receiving emails from it,
> > >> send an email to
elixir-lang-ta...@googlegroups.com.
> > >>
> > > To view this discussion on the web visit
> > >>
https://groups.google.com/d/msgid/elixir-lang-talk/CAOMhEnx5840q6z5sYzB8BtADrEhpWgFV852ToQ6maQu07%2B%3Dm6w%40mail.gmail.com
> > >> <
https://groups.google.com/d/msgid/elixir-lang-talk/CAOMhEnx5840q6z5sYzB8BtADrEhpWgFV852ToQ6maQu07%2B%3Dm6w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> > >> .
> > >
> > >
> > >> For more options, visit
https://groups.google.com/d/optout.
> > >>
> > >
> > >
> > > --
> > >
> > >
> > > *José Valim*
> > >
www.plataformatec.com.br
> > > Skype: jv.ptec
> > > Founder and Director of R&D
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "elixir-lang-talk" group.
> > > To unsubscribe from this group and stop receiving emails from it,
> > > send an email to
elixir-lang-ta...@googlegroups.com.
> > > To view this discussion on the web visit
> > >
https://groups.google.com/d/msgid/elixir-lang-talk/CAGnRm4LOxCeCbWhKeLJS_cEbp_iPyzTdNHRaWMQrMweATBh0FA%40mail.gmail.com
> > > <
https://groups.google.com/d/msgid/elixir-lang-talk/CAGnRm4LOxCeCbWhKeLJS_cEbp_iPyzTdNHRaWMQrMweATBh0FA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> > > .
> > > For more options, visit
https://groups.google.com/d/optout.
> > >
> >
>