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.
Fixed!
Fixed!
Random tests should run a consistent number of times, doing a random amount of tests between 1 and 10 is not really sufficient.
Just bump it up to 100 tests, there is no concern with performance here.
Random tests should probably also test for lazy evaluation.
.
Just because code compile doesn't mean it's correct. Is it really that hard to understand?
I'm sorry, I'm still not seeing how one would make the ternary usage compile, even if they just return the hard coded answers.
However, I'll give you that a random test is not so hard to implement. I have added them!
Making the type check by just returning hard-coded values is considerably easier than actually evaluating the conditions correctly, since then you can throw away the left/right branches and return whatever you want. The tests would be laughably easy to satisfy with this.
.
The reason why I don't see a need for Random tests, is that I'm tasking the solver to make the following line compile
val booze = (age < 21) ? "Cranberry" | "Cosmo"
Ofcourse I could randomly change the boolean condition, But if they're able to make the usage of ternary operator compile, I believe they have solved this Kata.
This comment is hidden because it contains spoiler information about the solution
If you don't know, then why're you writing a Scala kata? I'd expect someone making a kata about language features to be familiar with the features of the language itself.
Then your kata is trivial to be hard-coded.
Every kata requires random tests for a good reason. Do you have any convincing reasons to not add them?
Added a comment clarifying this!
This comment is hidden because it contains spoiler information about the solution
Loading more items...