Ad
  • Custom User Avatar

    This was fun until I had to tweak the solution so that it adheres to some not-understandable edge cases...
    I ended up with what I would probably call the ugliest code snippet I have ever written :-).

  • Custom User Avatar

    Awesome fu here, thanks. Especially fusing the array traversals and the shift.

    It's a bit cryptic though, always the same problem :).

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Hi! I wonder if rustc optimizes the two traversals into a single traversal? Does anybody know?

  • Custom User Avatar

    This is one of the best katas I have ever completed! Thanks!

  • Custom User Avatar

    Updated the solution.

    Man, I just destroyed two hours of work on another kata in a glimpse. It all started when I forgot my mouse at work. When I was working on the kata, I had to use my laptops' touchpad, which I am not used to at all. Then suddenly, I must have done a finger gesture which made my browser turn back the page - and all was lost. Now I cry like a baby....!

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Thank you for reporting the problem! I think I fixed all issues. Sorry for the inconvenience!

    I took your solution as complete working solution.

  • Custom User Avatar

    For Rust, when clicking "Attempt", this kata only compiles when the import statement use std::str::FromStr; is added. At first, I did not use FromStr and passed the "Test" step, but could not run "Attempt". Further, the visible tests have the expected solution on the LEFT while the hidden tests have the expected solution on the RIGHT. This confused me during debugging.

  • Custom User Avatar

    You may have commented another version of this solution, but I do not see how primes are recomputed. First, the upper bound is computed, then all primes until the upper bound.

  • Custom User Avatar

    I have a Factor translation pending which tries out a new method of testing. I do two tests:

    1. does the users result match a reference solution's result when evaluated for a handful of values of x
    2. are there any further simplifications that the user has missed

    And if both are passed then the test case is considered passed. This can become somewhat finicky as certain expressions can result in all kinds of invalid, or rediculously large values, but with care I think that it could be the best way to test this kind of kata.

  • Custom User Avatar

    Would it be unreasonable to just expect the unchanged order of the input for this case? Should the kata be changed ( some simplifications are already explicitly not expected ), or should the description just be expanded?

    Is this a language-specific suggestion, or do you want this to apply to all languages?

  • Custom User Avatar

    Nice solution, thanks!

  • Custom User Avatar
       expected: "(* -1 (sin (+ x 1)))"
        but got: "(* -1 (sin (+ 1 x)))"
    

    That should also work. A rule could be that literals should always be on the left hand side (if the operator is commutative).

  • Custom User Avatar

    I agree. I also get:

      expected: "(* -1 (sin (+ x 1)))"
        but got: "-(sin (+ x 1))"
    

    And so on.

  • Loading more items...