6 kyu

Collapse Left

135 of 230Uptyler
Description
Loading description...
Arrays
  • Please sign in or sign up to leave a comment.
  • Just4FunCoder Avatar

    Python fork

    • Address the print and input mutation [issue]
    • Address the snake_case [issue]
    • Added the examples in the description as fixed tests.
  • Awesome A.D. Avatar

    In python, the tests log the inputs for some reason (please remove all print functions from tests).

    But more importantly, the tests are vulnerable to users mutating the input

    test.assert_equals(operationArguments(testArr), testCaseOperationArguments(testArr))
                                          ^^^^^^^                              ^^^^^^^
    

    In fact, mutating the input causes random tests to consistently throw an error.

  • mauro-1 Avatar

    Python: function name should be snake_case

  • JohanWiltink Avatar
  • JohanWiltink Avatar

    Fixed tests should have fixed expected values. Do not rely on a reference solution, as the "with functions" fixed test does.

  • B1ts Avatar
    expected
    [ +0, -9, +0, +0, 3, 3, 100, 16, 20, 5, 5, -8, 2, 4, +0, 6, +0, 4, 40, 1, -6 ] to deeply equal 
    [ +0, -9, -0, +0, 3, 3, 100, 16, 20, 5, 5, -8, 2, 4, +0, 6, +0, 4, 40, 1, -6 ]
              ^
    

    Really? :/

  • JohanWiltink Avatar

    The description could be better: more explicit specs and less reliance on examples. Ideally, the description should be correct and complete without any examples; examples can clarify, but must not specify.

    I don't have to like variadic functions ( just pass an array? ) and I don't have to like heteregeneous arrays ( and I don't, but the usage here makes it hard to avoid ), but I can get over that.

    The task seemed artificial, but once I got to implementing, it actually flowed rather elegantly, which was nice, very nice; I like elegant. :]

    I would like to encourage people to subtitle their vote; do all those Mehs mean this kata is hopeless, or should the description just be improved a little?

    • Uptyler Avatar

      This comment has been hidden.

    • JohanWiltink Avatar

      The description usually is the hardest part. Welcome to creating kata. :P

      Most solvers don't even use arguments, but a rest parameter, thus defeating your purpose. It also makes translating harder, because the description becomes inconsistent between languages. I'd advise against it, but other opinions may be available.

    • dfhwze Avatar

      For beginners, this might be a fun and challenging kata. I just wonder whether this hasn't been done before ...

    • Uptyler Avatar

      "Most solvers don't even use arguments, but a rest parameter, thus defeating your purpose"

      That is correct, but either way requires a use of lesser known features of js as opposed to iterating over a given array parameter.

    • JohanWiltink Avatar

      To my best recollection, no, this is novel.

    • JohanWiltink Avatar

      either way requires a use of lesser known feature of js

      OK, fine.

      Please just don't do it. It makes translations harder to create.

    • Uptyler Avatar

      I would be ok with switching the input to be a heteregeneous array, but I would like recommendations on how to improve the description's lack of clarity.

    • trashy_incel Avatar

      I had to guess what to do from the examples, because the description does not say:

      • that numbers that are not followed by a function should appear as-is in the output
      • that "closest number to the left" applies to the output array being constructed, not to the input array, i.e. functions can be called with the result of the preceding one
    • JohanWiltink Avatar

      Please read https://docs.codewars.com/authoring/guidelines/description.

      I'm not complaining about lack of clarity, I'm complaining about specification by example, which in practice is an invitation to solvers to read author's mind, something solvers are notoriously bad at.

      ETA: just noticed that you already updated the description. what you have now is not bad at all! it could be more clear that multiple functions working on a single argument result in a single element in the output; [0,inc,dec] could also result in [1,-1], but that's not the intention. the "collapsing" could be expanded on, or an example could specifically clarify this ( this is what examples are for! ).

    • JohanWiltink Avatar

      Having an example of "how not to do it" in the description is not working for me. I'd suggest just taking that out.

    • JohanWiltink Avatar

      Please approve this fork addressing test suite maintainability, futureproofing, and robustness, and description consistency.