Re: [elixir-core:11267] [Question] :math module

2023-02-23 Thread José Valim
FWIW, Elixir already has a GCD: Integer.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

Re: [elixir-core:11269] [Question] :math module

2023-02-23 Thread Julian Somoza
I was left wanting to comment on the following, perhaps for fear of responding to Valim himself  and sounding daring. >From my humble opinion and user experience of several years programming (other languages), I feel more comfortable with an *Integer* module for things like* Integer.to_string*

Re: [elixir-core:11268] [Question] :math module

2023-02-23 Thread Julian Somoza
Thanks Jose! I didn't know about Integer.gcd/2 Although *gcd* was an example, I assume that any proposal related with Maths must be added on Integer / Float, etc modules... Is that the way to add "number-crunch" functions? This is what I had in my head: defmodule Math do def pow(base, exp), do:

[elixir-core:11261] Force compilation of a single file/files for benchmarking purposes

2023-02-23 Thread Tobias Pfeiffer
Hi everyone and as always, thanks for your amazing work! Jokes have been lobbied at me in the spirit of the "breaks my worlfow" XKCD [1] - but, please here me out! Since the (amazing!) 1.13 [2] elixir semantic recompilation changes I can't easily force recompilation on single files. The best

Re: [elixir-core:11261] Force compilation of a single file/files for benchmarking purposes

2023-02-23 Thread José Valim
Could you potentially use `mix run lib/my_file.ex` for those cases? On Thu, Feb 23, 2023 at 10:27 AM Tobias Pfeiffer wrote: > Hi everyone and as always, thanks for your amazing work! > > Jokes have been lobbied at me in the spirit of the "breaks my worlfow" > XKCD [1] - but, please here me

Re: [elixir-core:11262] Force compilation of a single file/files for benchmarking purposes

2023-02-23 Thread Wojtek Mach
You can also force recompilation by defining this function:    def __mix_recompile__?, do: trueWiadomość napisana przez José Valim w dniu 23.02.2023, o godz. 11:20:Could you potentially use `mix run lib/my_file.ex` for those cases?On Thu, Feb 23, 2023 at 10:27 AM Tobias Pfeiffer

Re: [elixir-core:11264] Force compilation of a single file/files for benchmarking purposes

2023-02-23 Thread Tobias Pfeiffer
Interesting! I always forget elixir modules are also "just" evaluated until I don't. `mix run --no-start` does indeed seem to work for this use case! Thank you! On Thursday, February 23, 2023 at 11:20:01 AM UTC+1 José Valim wrote: > Could you potentially use `mix run lib/my_file.ex` for those

[elixir-core:11265] [Question] :math module

2023-02-23 Thread Julian Somoza
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

Re: [elixir-core:11266] Force compilation of a single file/files for benchmarking purposes

2023-02-23 Thread Tobias Pfeiffer
Thanks, I know :) The problem with that is wanting to run a benchmark with all examples in it, so this would always force compilation for all 3 files which doesn't help with that particular benchmarking case. On Thursday, February 23, 2023 at 1:26:59 PM UTC+1 woj...@wojtekmach.pl wrote: > You

Re: [elixir-core:11266] [Question] :math module

2023-02-23 Thread 'Andrey Yugai' via elixir-lang-core
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