Ad
  • Custom User Avatar

    It is really amazing!

    But, please, please, never put this in a production code, ok? Hahaha!

  • Custom User Avatar

    Thank you, that made the trick.

    I love good news, specially when they come with a good advice!

  • Custom User Avatar

    I like how the object english is beautifully formatted.

  • Custom User Avatar

    This is clever but, clearly, not good practice.

  • Custom User Avatar

    I get this error:

    Test were full text cannot fit in memory all at once: parse by chunks!
    Process was terminated. It took longer than 6000ms to complete
    

    My code is taking the chunks one by one in two nested loops and, AFAIK, it doesn't have anything that would make it slow but, still, I get the error almost every time.

    Theres something, though, that makes me think that there could be a problem with the grader: A couple of times, I've got "green" but when I refactored the code (mainly deleting commented lines), I pressed submit and I've got the error again. Is is possible that my code is slow because the grading server is overloaded?

  • Custom User Avatar

    There is not glory on spending several hours trying to solve a problem that you can google in 3 minutes. ;)

  • Custom User Avatar

    Some extra tests in Haskell, translated from the ones that @jmjjg created in JavaScript:

    describe "empty arrays" $ do
      it "An empty array has not all elements greater than zero" $ do
        A.all (>0) []   `shouldBe` False
      it "An empty array has not any element greater than zero" $ do
        A.any (>0) []   `shouldBe` False
      it "An empty array has none element greater than zero" $ do
        A.none (>0) []   `shouldBe` True
      it "An empty array has not all elements lower or equal than zero" $ do
        A.all (<=0) []   `shouldBe` False
      it "An empty array has not any element lower or equal than zero" $ do
        A.any (<=0) []   `shouldBe` False
      it "An empty array has none element greater or equal than zero" $ do
        A.none (<=0) []   `shouldBe` True
    
  • Custom User Avatar

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

  • Custom User Avatar

    I think it is more "beautiful" to test for a positive (points>=100) first, instead of false. But maybe it is just a personal preference.

  • Custom User Avatar

    This is the good one!

  • Custom User Avatar

    I was starting to create an implementation of BigInt that allowed me to multiply and get the modulo of large numbers while storing them as strings. And then I realized that the solution was waaaaaay simpler than that.

  • Custom User Avatar

    That is the solution for the kata. I guess this is a problem more for people who likes mathematics. The programing part is quite trivial (3 lines of code).

  • Custom User Avatar

    That shouldn't be voted "Best Practices". Recursion is most of the time a bad idea in Javascript.

    http://jsperf.com/fibonacci-codewars

  • Custom User Avatar

    Yes, it would be an amazing idea to classify the answers also by performance!

    It could work similarly to to http://jsperf.com/ . Any user should be able to test all the sollutions in his own browser. The numbers shown should be the average of all runs for the last version of Chrome and Firefox... And maybe IE, but I don't think many people access this site with IE.

  • Custom User Avatar

    In my opinion it could be nice to add a test with a randomly generated cipher code in order to avoid solutions with a hard-coded code.