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.
This comment is hidden because it contains spoiler information about the solution
"short-circuits" means that the "around" method prevents some other method from being called.
Common Lisp uses PUSH. My apologies for the confusion. IIRC, I've seen Scala examples that also use PUSH in this sense. It has been natural for me to think of PUSH in this direction since VAX assembly language though... It throws me off that Perl's push() is append.
I agree that your solution works in this case. If, however, all of the '+' signs had been '-' signs, your parse tree would have to have a different shape. Did you really code '+' to be right associative and happen to still get '-' as left associative?
I was going to change the test case to make it explicit, but I don't have time to get it right today. So, I'll just say this... the parse tree shown above does not agree with the BNF in the description. The BNF says that an expression is a term or an expression '+' a term or an expression '-' a term. It doesn't say that it can be a term '+' an expression.
Only if the 'next' needs to change.
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)'.
This comment is hidden because it contains spoiler information about the solution
Should be fixed now.
I'm not sure what to tell you. There aren't very many test cases. That one is the last one. Are you timing out while compiling it or while evaluating it? You're sure that you can compile and simulate that function (because a number of times that I've thought things were timing out on me unfairly, I found an edge-case infinite loop or stack overflow in my code)? I know you say it works in your chrome devtools, but does it work if you make your own test here on Codewars? There are some differences in Javascript implementations.
"ISBN-10 identifiers are ten digits."
Which test grouping is this? Was it my test code calling your method or was it being called from an around method? or a before method? Specifically, how is it that it got the 'Mammal' discriminator right but no arguments?
There aren't any particularly tricky test cases. The closest to a tricky on is appending a list to itself. If you somehow make that into a loop of sorts, then you'll run into trouble calling
length()
on it. Other than that, it may just be load on the codewars servers? shrugIf you define two primary methods with the exact same discriminator, the second replaces the first.
I'm not sure what you mean about "calls the method is being called with no arguments". All of the tests call your method with arguments, but "callNextMethod" is always called with arguments, too.
It means that when I called your implementation of 'contains()', you looked for the item in a branch of the tree that you didn't need to go down.
I guess I can see that. I believe one can share more nodes if one takes the left-most node of right or the right-most node of left and bubbles it up to take x's place. But, maybe I should loosen the tests in that case.
Loading more items...