Ad
  • Custom User Avatar

    Ah makes sense, the other test cases that expected an error declared that though.

  • Custom User Avatar

    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.

  • Custom User Avatar

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

  • Custom User Avatar

    Javascript implements the modulus operator differently. I think I should probably point that out in the description. Hopefully it isn't locked yet.

  • Custom User Avatar

    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)

  • Custom User Avatar

    The test case expects an error.

    Hint:

    output number, stack []

  • Custom User Avatar

    Thank you. In fact I've understood different. The phrase seems to be ambiguous, doesn't it?

  • Custom User Avatar

    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?