> Why should we add this to Elixir core, instead of "extending" with module?

I have been a big proponent of this for a long time because just about
every code base uses the identity function and it's a barrier to those who
would learn Elixir.

Rather than import or call &FP.identity/1, most would just continue to use
something like & &1, and that's generally tough on beginners.

-bt

On Fri, Jul 12, 2019 at 12:59 PM Chulki Lee <[email protected]> wrote:

> I'm happy to see Elixir adopting FP concept here ([identity function](
> https://en.wikipedia.org/wiki/Identity_function)), but I'm not sure it's
> good to add it to `Kernel` (as it's imported by default!) - or even in
> Elixir core.
>
> Why should we add this to Elixir core, instead of "extending" with module?
>
> ```elixir
> defmodule FP do
>   def identity(a), do: a
> end
>
> def module YourApp do
>   import FP
>
>   def hello do
>     'abcdaabccc' |> Enum.sort |> Enum.chunk_by(&identity/1)
>   end
> end
> ```
>
> For example, that library can be de-facto helper for such FP utility
> functions.
>
> --
> 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/2e98526b-e83c-4b92-8035-26bce95da822%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/2e98526b-e83c-4b92-8035-26bce95da822%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Regards,
Bruce Tate
CEO

<https://bowtie.mailbutler.io/tracking/hit/f8218219-d2a8-4de4-9fef-1cdde6e723f6/c7c97460-016e-45fb-a4ab-0a70318c7b97>

Groxio, LLC.
512.799.9366
[email protected]
grox.io

-- 
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/CAFXvW-5vOv15iAWWH6qvbyUPf7KrY2Smw0oBKdf56%3DLPiH9BNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to