Ad
  • Custom User Avatar

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

  • Custom User Avatar

    "short-circuits" means that the "around" method prevents some other method from being called.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Only if the 'next' needs to change.

  • 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

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

  • Custom User Avatar

    Should be fixed now.

  • Custom User Avatar

    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.

  • Custom User Avatar

    "ISBN-10 identifiers are ten digits."

  • Custom User Avatar

    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?

  • Custom User Avatar

    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? shrug

  • Custom User Avatar

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

  • Custom User Avatar

    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.

  • Custom User Avatar

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