I definitely agree that it's better to import it from an additional module
if need be.

If we ignore the Metaprogramming parts, Elixir has a very easy Syntax and
the &(&1) notation is one of the only non-intuitive things to learn.
Compared to other languages, there are virtually no 'weird' syntax elements
you have to 'just remember' when you start out, so I am actually in favor
of teaching people this shorthand instead of hiding it from them. (It's
really not THAT complicated)

Also, as José said, you can always use "fn x -> x end", which is about the
same length as "&identity/1" and also obvious in what it does.

I don't think expanding the Kernel just for the sake of adopting concepts
of similar ecosystems is worth it.

Sven

On Fri, Jul 12, 2019, 23:10 Rich Morin <r.d.mo...@gmail.com> wrote:

> > On Jul 12, 2019, at 13:43, José Valim <jose.va...@plataformatec.com.br>
> wrote:
> >
> > Filtering nils may be considered bad practice (i.e. why do you have nils
> there?)
>
> I use them, on occasion, to support a "maybe" type.
>
> > ... it may be more readable to do with Enum.reject(&is_nil/1).
>
> Cool!  I just replaced four instances of `Enum.filter(&(&1))` with
> `Enum.reject(&is_nil/1)`.
> FWIW, I'd love to see an annotated collection of suggested Elixir idioms
> such as this one.
>
> -r
>
> --
> 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 elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/C4BDFC3F-1646-4957-B814-0204D3B147A6%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAFuVuxzkdQbPZaPHRWA6w13LE1jFZm-sgoxK8ToOkTag2_9AbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to