FWIW, Elixir already has a GCD: Integer.gcd/2
<https://hexdocs.pm/elixir/Integer.html#gcd/2>.

On Thu, Feb 23, 2023 at 6:32 PM 'Andrey Yugai' via elixir-lang-core <
elixir-lang-core@googlegroups.com> wrote:

> There's not so much elixir can do to improve erlang's :math, it's already 
> implemented
> <https://github.com/erlang/otp/blob/master/lib/stdlib/src/math.erl>with
> NIFs. Rewriting it in pure elixir/erlang would only degrade performance.
>
> Other question is why doesn't :math have more functions? BEAM wasn't
> built for the purpose of number crunching - there's plenty info about slow
> math in erlang. Although it had improved recently, I'd recommend to look
> into elixir nx or similar tools. If I understand correctly, they
> effectively bypass BEAM bytecode/NIFs shenanigans, and compile to native
> code with vectorization and whatnot.
>
> If erlang would add something unholy to its stdlib, you'll be free to
> ignore it, and keep using your righteous implementation :)
>
> ------- Original Message -------
> On Thursday, February 23rd, 2023 at 22:23, Julian Somoza <
> julian.som...@gmail.com> wrote:
>
> Hi, I would like to understand why or what would be the problem with
> having our own Math module on Elixir. I know that some people think that
> has no sense to duplicate modules that already exist in Erlang but... Where
> is the "sovereignty"?
>
> If I would like to add a new math function, why do I need to ask another
> language (Erlang) to be able to have it in Elixir. Elixir could have a Math
> module implementing/bypassing :erlang base function, and adding extra
> functions "over" without dependency...
>
> For example, if I would like to propose a GCD function for :math and the
> community approve the de proposal, I would need to go to another community,
> ask there, program it in erlang (learn a bit of erlang of course), wait for
> the release, update and update the erlang version on my servers...
>
> On the other hand, what happen if Erlang add things to the core which we
> don't like to have? We are always obliged to accept what comes from above?
> Having our own Math module we could decide to not have GCD function if in
> Elixir we think that is not necessary or just don't like to have it.
>
> Just sharing my thought, I hope I don't offend anyone, and wish to read
> another point of view.
>
> Best,
> Julian.
>
> --
> 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/b66261a7-9f17-4c10-b2d8-0f77b0c338ben%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/b66261a7-9f17-4c10-b2d8-0f77b0c338ben%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> 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/HYb5YF6P5tzJFgwRetwx29BnzhQhx6qysrldv8ST-TaQ5hGTHkFWOGuQJevlHOxgCYgJ7XQX_NkXsi0ZNMbtezuS6N7g5u3aSBpJhrmjRWo%3D%40pm.me
> <https://groups.google.com/d/msgid/elixir-lang-core/HYb5YF6P5tzJFgwRetwx29BnzhQhx6qysrldv8ST-TaQ5hGTHkFWOGuQJevlHOxgCYgJ7XQX_NkXsi0ZNMbtezuS6N7g5u3aSBpJhrmjRWo%3D%40pm.me?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAGnRm4J2EAfyP_3_94tjKoNDjNJePB6Nwijea7oz9z8L9tbkjA%40mail.gmail.com.

Reply via email to