Ad
  • Custom User Avatar

    It would help if the tests have descriptive names. Something like "ShouldReturnOriginalTo2Places" would help indicated that they need to round (if they forgot it was in the spec).

    Also, the example in the description should have the 2 places ("...the function should return an original price of $100.00")

  • Custom User Avatar

    Create a find fuction that we passed a array and a string. If the string is in the array return true.

    Mispellings and grammer errors. Suggest:

    Create a find function that takes a string and an array. If the string is in the array, return true.

  • Custom User Avatar

    Yes, the tests do not explicitly check for this, so will randomly fail but mostly pass.

    I'm not sure how you would perfectly check for this, but this has less of a chance of it passing without ever returning a maximum:

    var count = {1:0, 2:0};
    for(var i=0; i<100; i++) {
       count[dice(1,2)]++;
    }
    Test.expect(count[2]>0, "Did not return 2 out of 100 rolls of dice(1,2)");
    
  • Custom User Avatar

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

  • Custom User Avatar

    I agree in both cases (don't like errors, too early for Maybe). I guess the main question is, do we want the Kata to be opinionated, or should it leave it up to the user?

    Since the problem isn't defined for k <= 0, you can't just fill in a value. It also hides problems when using elementAt.

    I think the way you did it (using undefined) is the most mathmatically sound way, but it gives no help in fixing the error (generic "Prelude.undefined" error message).

    I think returning a specific error message will help with debugging. So I would vote for expecting an error to be thrown.

  • Custom User Avatar

    One problem I had with this on the 99 questions originally is it doesn't say what 0 or less should return. It is left up to the programmer to think about what that means. Shouldn't that be specified?