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.
My God. Who are you, alien?
But your solutions, guys are much more shorter than mine :)
Aaaaand yeah! Machine::new(...).go()
Hope tomorrow I will clean it out.
Guest was actully me. Lost my session. Insidious codewars.
Man, if only you leave some comments and give variables some relevant names I would build a memorial in your honor.
This comment is hidden because it contains spoiler information about the solution
Can it pass the test such as solution(["a","b","c"],3,"a")? I think it should return a
Does this qualify as "easily?"
signmod = index < 0 ? 1 : 0
(index.abs() < items.length + signmod ) ? items[index] : default_value
@wchargin, I think it's fine to use the ternary ? operator here. Is that what you meant by this isn't very Ruby?
See http://stackoverflow.com/questions/4252936/how-do-i-use-the-conditional-operator-in-ruby
This isn't very Ruby. (1) you should use the builtin
fetch
, (2) if not, you should useunless
statements instead.