Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
it's a pity 8 years later, we still have to guess
Saved me from hours of debugging/testing.
Thank so much! That's it :)
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.
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)'.
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?
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.
That test removes
a
from a list containing onlya
, and expects to get back an empty list. The error message is describing what the test expects to happen, rather than what actually happened.