Ad
  • Custom User Avatar

    @GiacomoSorbi's JS and Ruby translations are completely wrong:

    • The input argument writes iterable in all language versions. A iterable does not have length since it can be infinite. So why are you trying to get the length of the iterable?
    • Similarly, getting the length of the iterables will iterate the whole iterable once, which will exhaust generators
    • Iterables cannot be indexed
    • (Ruby) String isn't an iterable

    This goes on to show that the tests are far from sufficient and we need more actual iterables.

    @Souzooka's C# translation is also wrong, it'll fail for IEnumerables that is mutable (e.g if it's from an IEnumerator).

    Also, needs random tests.

  • Custom User Avatar

    Thanks Voile, will keep that in mind next time :)

  • Custom User Avatar

    Yes, there are problems with the ruby version (actually JS version too). Gonna raise a separate issue.

    Also, don't use split(""), use chars. Learn best practices ;-)

  • Custom User Avatar

    I don't think it works that way in ruby; you'd have to coerce it into an array with split("") before iterating....

    Just go to issues and scroll and read. I'm pretty sure strings are not iterable in ruby. I'm no python expert so I can't comment, but according to others they seem to agree. Conceptually I don't see how you can iterate a string, that just doesn't make sense. You can coerce it into individual characters, but that's an array where each element is an individual string character.

  • Custom User Avatar

    Out of spec.

  • Default User Avatar

    as everyone else has been saying

    Where so???

    for c in "slfkghsdkjghf": ...
    

    Works perfectly in python, for example. I guess JS or ruby provide the same kind of thing.

  • Custom User Avatar

    Right, but as everyone else has been saying, a string isn't technically iterable either yet that is something we want to evaluate.

  • Default User Avatar

    The description states that the input is a sequence. Meaning it is iterable. So having a simple number is out of the scope of the current task and falls in the domain of the "invalid inputs".

  • Custom User Avatar

    I think this kata is kind of confusing and there aren't enough test cases. For instance, you want "ABBBCD" to return ["A", "B", "C", "D"] here but what if the input was a pure integer 122234? Is this considered unique in that, that is a unique number different from any other integers, or should it return 1234? or should it return [1, 2, 3, 4]? Doesn't actually address a myriad of other inputs and what is expected of the output.

  • Custom User Avatar

    Not sure why you pasted your solution which is different from the onne that is being commented on, where it[0] is not 1 and is really undefined.

    I think the problem is, the test case actually doesn't test for pure integers, and that's why it doesn't catch this.

    This solution doesn't work if the input is 123334, but the test case is an integer array [1, 2, 3, 3, 4], where comparison is still valid and the returned array still works.