flatten added

This commit is contained in:
Denis Knauf 2010-06-23 16:40:01 +02:00
parent 28dee69c07
commit 95a3027926

View file

@ -154,6 +154,12 @@ class Functional
end
end
class Flatten <Base
def call a
Array === a ? a.each( &method( :call)) : @next.call( a)
end
end
class Reduce <Base
def initialize iv, *a, &e
super *a, &e
@ -218,6 +224,10 @@ class Functional
push TopDown.new( init, &exe)
end
def flatten
push Flatten.new
end
def each &exe
return self unless exe
push Each.new