I'm new about ruby! I just wanna do the following:
module Functional
def filter
end
end
class Array
include Functional
def filter
end
end
a = [1, -2, 3, 7, 8]
puts a.filter{|x| x>0}.inspect # ==>Prints out positive numbers
How could I modify the method "filter" in Array? Could anybody help me? Thank you
nilas output . Counterexample? :)