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.
This could be improved by defaulting
args
to[ :to_f ]
, thus eliminating the need for the ternary operator.This comment is hidden because it contains spoiler information about the solution
I couldn't really see a way to handle
in_range
in the same way as the others, without cracking openInteger
as well, which I was trying to avoid. However, I've just realised myin_range
method is broken.I like the way you've extended
Integer
so that you can generalise the filter, but don't like the indiscriminate use ofmethod_missing
. Also, you could DRY upunder
andover
.This is the right idea, but has side effects, so can't be counted as "best practice".
Where does it say that the Matrix library is off-limits?
What if your hash looks like this?
Brilliant! Wish I could mark this is "Best Practices" AND "Clever".
Doesn't this achieve the same thig?
Nice trick to use a lambda, but using a recursive function to iterate over Fibonacci takes O(n^2) time.
What if you're given ']' as a comment marker?