views:

43

answers:

1

Suppose I have the following Ruby code:

array_1 = ['a', 'b']
array_2 = ['a', 'b', 'c']

some_function(array_1, array_2) # => True
some_function(array_2, array_1) # => False
some_function(['a', 'b'], ['a', 'd']) # => False
some_function(['x', 'y'], array_2) # => False

I am pretty much looking for some_function to return True when Parameter 2 contains all of the elements in Parameter 1.

Thanks.

+5  A: 
def f a,b
    (a-b).empty?
end
Nakilon
Excellent. Thanks so much!
Mike
This is what I like about Ruby - so concise, sensible and readable.
Greg