Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
AI was very handy in generating all of 1-19 and 20-90 without doing it by hand :)
I accidentally implemented
mult
aspow
and didn't realise because the test case formult
said it was correct (2*2
,2^2
)This comment is hidden because it contains spoiler information about the solution
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.
What is the purpose of disallowing
print
andsys
for Python?Cool solution bro
Cool solution bro
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.
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 "$KataName
Spec" ( but not "$KataName
.Spec" because the unqualified part can't just be "Spec" .. sigh ).Yeah, you got unlucky. Most kata use
QuickCheck
instead ofRandom
; it's the expected standard, and there is something against usingRandom
though I don't know what exactly ( possibly it's slow, but I think QuickCheck uses Random under water anyway ).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 "$KataName
Spec" 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. )
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.
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?
I've submitted the beta to the mods to retire
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. :/
Loading more items...