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.
Why would this be more efficient?
Everything in Ruby is an object even numbers (Integer and Float classes)
As @Unihedron stated, you can define methods such as +(other), -(other), %(other)
You can even change + to do other operation (which is ofcourse a bad idea)
110% efficiency
hahaha
What in tarnation
Currently no. Also, I believe, there's already such suggestion on CW github.
right... but it didn't work! :D
Now I tried to figure out why...
main.rb:4:in 'each': undefined method 'self' for "a":String (NoMethodError) Did you mean? itself
as it turns out
group_by(&:itself)
works ;)explain please
group_by(&:self)
is a nice improvement. :)is it possible to search for kata using specific language?
For example if I wanted to search for Ruby kata, excluding any tranlsated ones.
thanks!
the best solution
Now you have. Operators in ruby are also defined as methods, so you can use them as methods
a*b
->a.*(b)
or redefine their methodsdef *(v)this*v end
.Before using any Ruby features, you should check since which version of Ruby they're available. And definitely not asserting any "errors" on arbitrary "not for production" excuses, it's not helpful at all ;-)
In this case, it's only available since 2.3.
It's seems doesn't work in older ruby version. I've tried with 2.2.3 version, it's a syntax error.
Maybe this is not a tick for production but quite nice trick.
Loading more items...