Closed boabdilperez closed 10 months ago
Hi @boabdilperez.
Those hints are common to all tracks, they are not Elixir specific, so they might not help as much with the lack of a proper sqrt
function in Elixir, which I agree is a little frustrating.
As you noted yourself, Integer.pow()
can't be used.
Float.pow()
can be used, but you have to trick integers into becoming floats, like this Float.pow( 25 * 1.0, 0.5)
. It is a bit strange that there is no Integer.to_float()
or something.
Finally, :math.sqrt
works as well, Elixir is proudly built on top of Erlang, so Erlang functions are fair game.
Those hints are common to all tracks, they are not Elixir specific
@jiegillet I can't find the hints in problem-specs, where did you take them from? Are they really global?
Oh no, you're right, I got mislead by something, they are not global -_- In that case, let's modify the file to mention what I said in the previous comment.
I was ultimately able to figure it out, but a bit less organically than I think is the intent of these exercises. Modifying those hints will be a big help to anyone else who comes along, I think. Thanks for looking into this y'all!
By the way, did you see the hints in the online editor or in offline mode? I can't find them at all.
I used the CLI but I see the hints in both. From the online editor there's a small button in the lower left "Stuck? Get Help" and if you download the test it's in HINTS.md in the top level of the directory created by the CLI tool.
-- Boabdil Perez
On Thu, Feb 1, 2024 at 10:35 PM Jie @.***> wrote:
By the way, did you see the hints in the online editor or in offline mode? I can't find them at all.
— Reply to this email directly, view it on GitHub https://github.com/exercism/elixir/issues/1430#issuecomment-1922800176, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI6Q6JC72NEKHC2ZIDX4VZLYRRUJTAVCNFSM6AAAAABCUST6LOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRSHAYDAMJXGY . You are receiving this because you were mentioned.Message ID: @.***>
I see, for me it's "Stuck? Ask ChatGPT". I tried it, asked me which model I wanted, then I could see the hints. When I reloaded I saw ChatGPT 3.5's suggestions (which were not helpful, but my code already had the square root part done).
I opened a PR, may I ask you to give it a review?
I was just trying to solve the "Darts" exercise. The hints include the correct formula to get the distance from origin to any given coordinate on a plane, but the provided workaround for the lack of a native square root function in elixir doesn't seem to work. The spec for
Integer.pow()
is expecting integers for both the base and the exponent arguments. The spec forFloat.pow()
is explicitly expecting a float for the base, and a number for the exponent.For the first test case of (-9, 9)
Checking the example.ex in the repo, I see that neither
Integer.pow
orFloat.pow
were used there, but rather the erlang math library. I'm apologize if I am missing something else, as I'm not great at geometry OR elixir.