Ad
  • Custom User Avatar

    I don't think your solution handles leap years correctly.

  • Custom User Avatar

    Think about rounding it as a different datatype, or try using ROUND() to round to an integer.

  • Custom User Avatar

    In what ways were the instructions misleading? Have they been fixed now? (I ask because I solved it by following the instructions and the output of the sample test: perhaps I misread the instructions.)

  • Custom User Avatar

    Yes, please add an instruction only to use postgres to the description, or switch off SQLite, as the error is still there.

  • Custom User Avatar

    Sounds good. It should probably be an 8 kyu kata, which are always useful.

  • Custom User Avatar

    Your English looks great! I think the best of the JS solutions copy the array first to avoid mutating the original array.

  • Custom User Avatar

    Nice kata. The JavaScript version of this feels like a 6 or 5 kyu kata.

  • Custom User Avatar

    I got that test to pass now - thanks for your patience - and for a really interesting kata.

  • Custom User Avatar

    This doesn't test for the infamous underflow bug. I don't think a 7 kyu kata should expect that. But perhaps this is an opportunity for a follow-up kata that forces the coder to rewrite or look up a formula that doesn't underflow. http://googleresearch.blogspot.co.uk/2006/06/extra-extra-read-all-about-it-nearly.html

  • Custom User Avatar

    Here is my test of block. My test passes, but yours doesn't. So I misunderstood something in the specification. Another hint might help.

        Test.assertEquals(getTime(), 0, "No timers started");
        block(100);
        Test.assertEquals(getTime(), 100, "After a block.");
    
  • Custom User Avatar

    What does this test result mean?
    Block did not affect time - Expected: 148, instead got: 200

    Does block() add an event to the event queue that will halt execution when that event is popped off the queue?

    I think (from the description) that it doesn't go on the queue, but stops simulated execution the moment it is called.

    If you can give me a hint without giving away how to design block() that would help.

  • Custom User Avatar

    I have written tests to match all the example code in the instructions, and wrote a curry function that makes them pass.

    But, all 16 tests in the kata fail.

    I would like a hint that would get me towards passing the first test.

    Here are my tests that pass:

    function plus(a, b) {return a+b;};
    var plusThree = curry(plus, 3);
    Test.assertEquals(plusThree(9), plus(9, 3), 'make a plusThree function');
    
    function minus(a, b) {return b - a;};
    var minusTwo = curry(minus, 2);
    Test.assertEquals(minusTwo(5), minus(2, 5), 'make a minusTwo function');
    
    function add(a, b, c) {return a+b+c;};
    var addOne = curry(add, 1);
    Test.assertEquals(addOne(2, 3), add(1,2,3), 'make an addOne function');
    Test.expect(add(1, 2, 3) === addOne(2, 3));
    
    var obj = {
      a: 'foo',
      b: function (a) { return this.a + a; }
    }
    obj.foobar = curry(obj.b, 'bar');
    Test.assertEquals(obj.foobar(), 'foobar', "invoke in context")
    
  • Custom User Avatar

    This kata seems to encourage beginners to do type tests. While facts shouldn't be hidden from beginners, I wonder if doing this kata so early in my Javascript/Ruby/Python/Coffeescript career might leave me more likely to reach for a type test rather than refactor the underlying data structure. What do you think?

  • Custom User Avatar

    I think you fixed your code already, but for the benefit of others, the output dog.toString() needs to change when the name is changed. Your version of toString() returns a string that never changes.

  • Custom User Avatar

    You return from your function on the first pass through the loop. Try accumulating a value then returning it.

  • Loading more items...