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

    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

    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.

  • 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.