Ad
  • Custom User Avatar

    There are random tests, but their order is completely deterministic: it's always true followed by false. So it's not really random at all, even a deep learning algorithm can learn to pass this.

  • Custom User Avatar

    This kata is a duplicate to many existing katas ("cycle check" and "dependencies" are very common keywords in katas...)

  • Custom User Avatar

    love this solution, I thought the same but yours so CLEAN. Love it, you clearly a genius

  • Default User Avatar

    For consistency, should hash values will be an Array?

  • Default User Avatar

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

  • Default User Avatar

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

  • Custom User Avatar
  • Default User Avatar

    Thanks for the quick update! However, your reset_complete! now does the same thing as complete! ;) It doesn't set @complete to nil.

  • Custom User Avatar

    Good points, I've updated the challenge. This is likely going to break a number of existing solutions.

  • Custom User Avatar

    Ah ha! Yes, the verbs used by the generator were not all in present tence. Fixed, thanks!

  • Default User Avatar

    Changing entered to enter and responded to respond should do the trick ;)

  • Default User Avatar

    Interesting kata. However, I found the description being confusing. You specify "the block passed in to attr_lazy should only be called, and its value applied to the variable, if the variable is nil." Yet your test cases specify that blocks should not reevaluate even if the block returns nil. What's probably meant and what most people understood is "... if the variable is not defined".

    I also noticed a small mistake in the test case should not call the block if the variable is set manually. You set @complete manually using complete! but you don't call check or complete? afterwards. Therefor the case doesn't test any AttrLazy effects at all. complete_checked_at is always nil.

    Also I suggest adding this test case:

    it 'should not call the block if the variable is set manually to nil' do
      example = LazyTest.new
      example.reset_complete! # sets @complete to nil
      example.complete?
      Test.assert_equals(example.complete_checked_at, nil)
    end
    

    My first solution actually allowed evaluation of the block if the variable was manually defined and set to nil before. All current tests pass but it's probably not the expected behaviour. The suggested test covers this scenario.

  • Custom User Avatar

    I see. I didn't do the ruby translation, and the js seems to work fine. You seem to be a lot more useful than me at potentially fixing this. Could you suggest a way?

  • Default User Avatar

    It's a mistake in the random test data. Check the verbs array in the ruby translation tests cases: verbs.grep(/ed$/) =>["entered", "responded"]. It should only contain verbs not already ending in ed.

  • Custom User Avatar

    Hi ojundt, thanks for your message. I can't replicate the error you have. Are you sure you are not defining any global variable?

  • Loading more items...