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.
Checking if the string length is odd is an obvious disqualifier that I didn't think to check for. Good call!
This comment is hidden because it contains spoiler information about the solution
I disagree with your "really bad solution" comment and encourage anyone interested in learning more about processing data with functional programming to read Martin Fowler's Refactoring to Collection Pipelines
A similar multi-stage pipeline approach is covered in the above article where Fowler refactors a loop that does multiple things in one pass into separate loops that each process the content with a different purpose. Fowler's article hits a number of different languages including c#, java and in this section, Ruby. In this section, he's quite clear with the section where he does this he introduces with the following:
Although he is using his "split loop" refactoring here, he ultimately transforms those loops into list processing functional programming calls. My point in citing his article is that he not only calls a loop that is doing multiple things at once a smell, it is the biggest smell for him in the code he is refactoring.
A fair comment. The longer the string, the more time is saved by checking for these easy cases upfront.