array.c: added method that verifies if an Array is part of another #127
It surprised me that |
@nobu the way I see it is |
It seemed like returning
Anyway, you should go to http://bugs.ruby-lang.org/projects/ruby-trunk/issues/new |
@nobu Done with the Feature Request: http://bugs.ruby-lang.org/issues/6515 |
1.9.3p125 :001 > a = [1,2,3,4,5] |
yap @hmaddocks. You're right, that's Set Theory. I'm proposing a much easier way to implement this theory making things much faster. If you review the code you can notice that I'm not comparing the sets because it's more expensive, instead I'm comparing the difference between them with an empty array. |
@hmaddocks I tested this PR and one importance difference is that it isn't order dependent as your example
but
|
The expression
implies to me that you are treating the arrays as atomic units yet your implementation is treating the array as an arbitrary collection of objects i.e., it's the contained objects that are being tested not the array.
|
I'm closing this, please refer to Feature #6515 on redmine. Thank you! |
This method is like the
include?
method but instead of receiving a value and check if the array has it, it receives an array an check if it's part of another one.