Ad
  • Custom User Avatar

    it's a pity 8 years later, we still have to guess

  • Custom User Avatar

    That test expects more than just that the result be an empty list. It expects it to be the exact same empty list that was at the end of the list '(a)'.

    Saved me from hours of debugging/testing.
    Thank so much! That's it :)

  • Custom User Avatar

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

  • Custom User Avatar

    Thats what I am returning, I'm returning its @next field. I've tried it both with that and a new EmptyList just to be sure.

    Nevermind, that was the issue. My problem wasn't with the ListNode code, but with the EmptyList push function.

  • Custom User Avatar

    That test expects more than just that the result be an empty list. It expects it to be the exact same empty list that was at the end of the list '(a)'.

  • Custom User Avatar

    I understand what the error message means, but mine won't pass that one either. I am returning an empty list in that case, I've tested it with my own test cases successfully. I KNOW I am returning an EmptyList and that it returns true for isEmpty(), but still no dice. Anyone else have this issue?

  • Custom User Avatar

    I'm a bit dissapointed with this kata series. Not only they're very easy, the tests do not cover every tricky case, opening doors for some cheap cheating.

  • Custom User Avatar

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

  • Custom User Avatar

    He just used high level functions for the purpose of this kata, with a simple algorithm in mind:

    1: Get first line in order (left to right), using shift on the matrix you get the first line.

    2: Last column in order (top to bottom), using map in the matrix, poping the last elements from every line.

    3: Last line reversed (right to left), using pop in the matrix you get the last array, and then reverse it (because of the snail logic).

    4: first column reversed (bottom to up), you again go through the entire matrix (using map) getting the first element (using shift) of each array, and then reverse it, since the other elements are being removed it works.

    Do it all over again until there is no more items.

    Hope it's clear enough.

  • Custom User Avatar

    Phew. Finally got a hold of remove() method, this one was tricky to guess right.

  • Custom User Avatar

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

  • Default User Avatar

    That test removes a from a list containing only a, and expects to get back an empty list. The error message is describing what the test expects to happen, rather than what actually happened.

  • Custom User Avatar

    Wow, that's not as easy as it looks.
    I managed to pass all the test past this one: 'Removing 'a' from '(a)': Test Failed: l1.remove(first) is empty'.

    Any hint? This seems a bit strange to me.

  • Default User Avatar

    Why all those checks when you can do with just "array.length < 2" ;-)
    Anyway, I like the solution, mainly because of its recursive nature.

  • Default User Avatar

    Can someone elaborate what's going on there? (: It's a bit complicated.