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.
Yup, came here to say that. all the invalid input tests are mostly just annoying, don't make much sense, and make everybody's code look worse.
Ahh, I forgot about
slice_when
. Really nice solution!This would have been nice to know going in. I wound up with these numbers hard-coded based on test cases and had no idea why.
Wow learned a lot from this example.
First of I've never seen to_proc (
&
) used on a hash before like that. Thats sweetI'm not entirely sure why each number is wrapped into singletons on the rhs of the hash though. Wouldn't a list of numbers work just the same?
This comment is hidden because it contains spoiler information about the solution
ever so slightly more pretty. I was thinking the same thing!
Fixed
Fixed
This is an old kata and back then nobody has any concerns about kata designs, naming practices or even comprehensive tests... groans And they even think that input validation is cool and is a valid way to sprinkle "difficulty" to katas, that pretty much all mediocre katas demand some form of trivial and yet annoying input validation.
I'm not going to revamp the entire kata and add comprehensive, random tests to all languages since it belongs to a massive batch of duplicates anyways (see this list), but I just fixed the setup code and change
is_valid
tovalid?
. It breaks all current solutions, but it's just ~250 of then, so I guess it's okay ;-)Seems not applicable anymore
I'll advocate removing the tests for invalid values. If that occurs, it's a bug in the calling code, not the lib. I think the lib should assume valid behaviour, or possibly raise specific errors, but definitely not mask the bug by returning
false
The Ruby setup is syntactically invalid, and Ruby's predicate is a suffix of
?
rather than a prefix ofis_
, hence:Other than that, nice kata :)
Explanation of some of the subler parts: https://twitter.com/josh_cheek/status/1023789398792568832
This comment is hidden because it contains spoiler information about the solution
EEerrrmmmm... Or the honor points? Or the progress feature...? ;) (well, the last one evolves slower and slower, yes)
Erm, do you mean the
Kata
section of your profile where you can find a list of all your solved and not solved katas?Loading more items...