Nice,
I like better
for reduce(acc = %{}), <<x <- "AbCabCABc">>, x in ?a..?z do
Map.update(acc, <<x>>, 1, & &1 + 1)
end
over
for <<x <- "AbCabCABc">>, x in ?a..?z, reduce: %{} do
acc -> Map.update(acc, <<x>>, 1, & &1 + 1)
end
On Mon, 20 Dec 2021 19:54:01 +0100
José Valim <[email protected]> wrote:
> Good point. I forgot to mention the :reduce option will be deprecated
> in the long term.
>
> On Mon, Dec 20, 2021 at 7:53 PM 'eksperimental' via elixir-lang-core <
> [email protected]> wrote:
>
> > The proposal is very concise,
> > the only thing that would be problematic is the use of `reduce` for
> > two different things,
> >
> > for <<x <- "AbCabCABc">>, x in ?a..?z, reduce: %{} do
> > acc -> Map.update(acc, <<x>>, 1, & &1 + 1)
> > end
> >
> > {sum, count} =
> > for reduce({sum, count} = {0, 0}), i <- [1, 2, 3] do
> > sum = sum + i
> > count = count + 1
> > {sum, count}
> > end
> >
> > It would lead to misunderstanding as it may not be clear which one
> > we are talking about when we say "use for reduce"
> >
> >
> > On Mon, 20 Dec 2021 19:11:54 +0100
> > José Valim <[email protected]> wrote:
> >
> > > Hi everyone,
> > >
> > > This is the second proposal for-let. You can find it in a gist:
> > > https://gist.github.com/josevalim/fe6b0bcc728539a5adf9b2821bd4a0f5
> > >
> > > Please use the mailing list for comments and further discussion.
> > > Thanks for all the feedback so far!
> > >
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "elixir-lang-core" group.
> > To unsubscribe from this group and stop receiving emails from it,
> > send an email to [email protected].
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/elixir-lang-core/61c0d119.1c69fb81.af520.c181SMTPIN_ADDED_MISSING%40gmr-mx.google.com
> > .
> >
>
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/61c0de98.1c69fb81.5c2e4.e958SMTPIN_ADDED_MISSING%40gmr-mx.google.com.