Ad
  • Custom User Avatar

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

  • Custom User Avatar

    You're making errors. In Haskell, there is no error tolerance.

    Order of operations is specified. The random tests conform to these specs, and they use exact comparisons.

    Error tolerance is for situations where the order of operations is not specified.

  • Custom User Avatar

    What is the purpose of disallowing print and sys for Python?

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Haskell:
    'expected -7.438096897115541 but got -7.438096897115539'
    Possibly I'm making errors, but on the random tests it's always slightly off.
    Should the error tolerance be increased for the random tests? Other issues mention 1e-06, but these numbers' difference is clearly < that.
    Perhaps it's due to the me parsing a string to a double character-by-character and not using read.

  • Custom User Avatar

    Note that Test Cases and Sample Test Cases both need to end in "Spec", but need not have the same name ( they can, and barring typoes, I always do though ).

    Also, you can use dots in names, so you could also do e.g. "$KataName.Solution", "$KataName.Preloaded" and "$KataNameSpec" ( but not "$KataName.Spec" because the unqualified part can't just be "Spec" .. sigh ).

  • Custom User Avatar

    Yeah, you got unlucky. Most kata use QuickCheck instead of Random; it's the expected standard, and there is something against using Random though I don't know what exactly ( possibly it's slow, but I think QuickCheck uses Random under water anyway ).

  • Custom User Avatar

    Modules should have unique names except for the test suites, and, specifically on CodeWars, the test suites' names should end in "Spec".

    I usually name the solution "$KataName", the test suites "$KataNameSpec" and Preloaded, if there, just "Preloaded". ( You can also leave Preloaded completely empty. )

    Preloaded can be imported in Solution and Test Suites ( separately ).

    I'll try to do a fork. ETA: I did. ( If you can, please reject that. Can't do that myself. )

  • Custom User Avatar

    Yeah I kinda just looked at another Haskell kata and used the same testing format; I guess I got unlucky and picked one that didn't use QuickCheck.
    Test code is just normal code that's not intended to be clever, but I'm flattered nonetheless.

  • Custom User Avatar

    I spent many frustrating hours trying to get the whole thing to be accepted and this was the only way it would even accept the code (see comment at the top of the preloaded code). It seemed to not let it submit because the 'solution' was not correct unless I also preloaded the solution. Absolute pain :/ . What should the modules be called?

  • Custom User Avatar

    I've submitted the beta to the mods to retire

  • Custom User Avatar

    Your Initial Solution uses the wrong module name.

    Preloaded is not the place for the reference solution anyway. ( The user solution could just import and reexport it, and "solve" the kata that way. ) This is documented!

    Not good. :/

  • Custom User Avatar

    Your test cases do not use QuickCheck and are quite unreadable and therefore unmaintainable. That is not the best way to write tests on here.

    Have a look at tests of existing kata, and see how they handle it. ( Not every kata will use Best Practices, but a pattern should emerge quite quickly. )

    Test cases are not the place to write Clever code ( as documented ). Write your most readable code; people who have to maintain your test suite in the future ( this may be you! ) will thank you for it. Sticking ( more or less, at least ) to what everybody else does is a good thing for the same reason.

  • Custom User Avatar

    The description specifies ")(" => true. Both the original and this translation expect that to be False.

    This kata lacks consistency between specs and tests, and even if this were to be solved, it's a duplicate. It does not need translations; it should be retired instead.

  • Loading more items...