Issue #6515 has been updated by Eregon (Benoit Daloze).


Eregon (Benoit Daloze) wrote:
>   as = a.to_set
>   b.all? { |e| as.include?(e) }
> 
> Which does not allocate an intermediary Array, and is O(n+m) as well.

But does allocate the Set for a of course (so likely not better).
----------------------------------------
Feature #6515: array.c: added method that verifies if an Array is part of another
https://bugs.ruby-lang.org/issues/6515#change-27007

Author: lellisga (Li Ellis Galardo)
Status: Feedback
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: 
Target version: 2.0.0


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.

https://github.com/ruby/ruby/pull/127


-- 
http://bugs.ruby-lang.org/