Ad
  • Default User Avatar

    Requirements:
    should return 17 items
    should have the correct column names
    should have the correct values
    should contain keywords
    should contain SELECT
    should contain RECURSIVE
    should not contain !
    should not contain CREATE TABLE

    Beeing honest... I had to hardcoded it to pass it.

  • Custom User Avatar

    Helpful comment, thank you.

  • Custom User Avatar

    Well, you can use debugger while coding on your machine. Its what I do. Most of the time it requires to rewrite tests on your own, but I believe it makes me a better programmer.
    Plus it will be realy hard todo for the random tests.

  • Custom User Avatar

    In this system, the last digit is always 0 and is in base 0!. The digit before that is either 0 or 1 and is in base 1!. The digit before that is either 0, 1, or 2 and is in base 2!, etc.

    You can't write 2x1!

  • Default User Avatar

    Please re-read the description.

  • Custom User Avatar

    So yes there's a trick to it?

  • Default User Avatar

    There're two stages:

    1. Totally algorithmical and requires no previous knowledge
    2. Getting the solution efficient enough to run within the time limit, and might require something along these lines
  • Custom User Avatar
  • Custom User Avatar

    Good first step is to check how long the cicle is.

  • Custom User Avatar

    I don't think 'human readable' means what you think it means. It feels like you're just reciting from whatever guide you learned it from.

    For tightly knitted stuff like this, as I said, a good balance between name readability and structure readability is hard. I'm not trying to bash you or anything, just to get you thinking about the benefit of short and concise code. Your original comment did seem like you think variables were shortened for completely no reason at all, and I was trying to say that it conveys the structure of the code better.

  • Custom User Avatar

    While it is usually a good idea to use longer appropriate variable names to convey information, blindly following this will not automatically lead to readable code. Here in your translation, the long names have the opposite effect, namely they drown out the mathematical operations and make it harder to figure out the structure of expressions.

    For example, your infected equation is missing parens around numberOfContacts * previousSusceptible * previousInfected - fractionOfRecover * previousInfected. See how easy it is to miss stuff when everything is so long, and also how it's unwieldy to talk about what you wrote?

    A good balance between name readability and structure readability is hard. In my opinion the kata description is fine.

    (I do hope that it was not just fear of maths that caused you to instinctively reject short names... That would be so unfortunate.)

  • Custom User Avatar

    You're right to be annoyed. I just don't understand why no one reported this problem before, or how that translation got approved at all.

  • Custom User Avatar

    It's not the kata's fault (well, sort of). I just noticed haskell translation is faulty and has no sample tests or initial code... Try another language.

  • Custom User Avatar

    D is the number of dimensions, N is the length on each dimension.

    => D=2, N=3 means a "2D squared array" 3x3. No contradiction with the description, afaik.

  • Custom User Avatar

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

  • Loading more items...