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.
betterHand function returns a Hand, so it is not clear what to do if hands are equal.
It's lazier; it works when
is
is infinite. I suspect (though I don't exactly recall) that's why I wrote it that way in the first place. Of course, the requirement to return the lexicographically least solution prevents doing anything useful with infinite lists, so it got transformed into this solution.If you're bothered by the possibility of creating nested loops, you could manually fuse it:
But I don't think that is necessary.
The real problem here is the use of
(!!)
, turning what should be a quadratic algorithm cubic.OMG.
indices
is a very brutal way to get N sequential integers. Consider usingPlease add more complex tests - as valid as invalid too. Current tests are VERY simple!
Actually, tests for equility need to be added:
This will detect such cheaters
Choose any your own variant, but write it clearly in kata task conditions.
I've added some invalid tests, one question is what to do with
""
? Is itNothing
or is itJust (Str [])
? Now I test forNothing
(as that's what my solution does :D) But I can change that.. What do you think?well spotted. thanks. Fixed.
cheers, I will add some invalid tests
at the end of second paragraph examples should be