oops. #reduce is better than #inject

This commit is contained in:
Denis Knauf 2011-02-13 17:38:13 +01:00
parent 68ab7003d5
commit a97c4ed1f9

View file

@ -192,7 +192,7 @@ class Functional
end end
end end
class Inject <Base class Reduce <Base
def initialize iv, *a, &e def initialize iv, *a, &e
super *a, &e super *a, &e
@buf = {} @buf = {}
@ -302,10 +302,9 @@ class Functional
push Map.new( &exe) push Map.new( &exe)
end end
def inject iv, &exe def reduce iv, &exe
push Inject.new( iv, &exe) push Reduce.new( iv, &exe)
end end
alias reduce inject
def select &exe def select &exe
push Select.new( &exe) push Select.new( &exe)