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.
Ah makes sense, the other test cases that expected an error declared that though.
The definition of modulo is very ambiguous simply because there are several different accepted definitions. Many call javascript's
%
a modulus operation. Additionally, I wouldn't consider Javascript modulus a true remainder operator, because it takes the sign after division. Historically, remainders have been annotated as non-negative integers. That's why I provided a definition in the description.I haven't even looked at this kata, but it might be helpful to note that in java, and javascript % is a remainder operator, NOT modulo (there is a difference).
Javascript implements the modulus operator differently. I think I should probably point that out in the description. Hopefully it isn't locked yet.
Are the modulus operator tests correct for JavaScript language?
I finished the kata, passing 104 tests. But these 2 tests for the modulus operator are failing:
5 % -3 (expecting -1, but got -2)
-5 % 3 (expecting 1, but got 2)
The test case expects an error.
Hint:
Thank you. In fact I've understood different. The phrase seems to be ambiguous, doesn't it?
Great kata so far, I'm not understanding the feedback from a failed test case
Here's a psuedo stack trace:
imp is stack command
push n
parse number 1 signValue 1
imp is stack command
push n
parse number 2 signValue 1
imp is stack command
push n
parse number 3 signValue 1
imp is stack command
parse number 32 signValue -1
(slide) discard number n -32
post slide stack [ 3 ]
imp is io commands
output number, stack [ 3 ]
imp is io commands
output number, stack []
top is undefined
imp is flow commands
quit called
output '3'
output length 1
Expecting only one value for slide with out of bounds index
So it's pushing 1,2,3 then removing everything except 3 using slide and outputting that twice, which should result in a single string of 3?