A
Size: a a a
A
DS
DS
Puppet::Functions.create_function(:reduce) do
dispatch :reduce_without_memo do
param 'Iterable', :enumerable
block_param 'Callable[2,2]', :block
end
dispatch :reduce_with_memo do
param 'Iterable', :enumerable
param 'Any', :memo
block_param 'Callable[2,2]', :block
end
def reduce_without_memo(enumerable)
enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
enum.reduce do |memo, x|
begin
yield(memo, x)
rescue StopIteration
return memo
end
end
end
def reduce_with_memo(enumerable, given_memo)
enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
enum.reduce(given_memo) do |memo, x|
begin
yield(memo, x)
rescue StopIteration
return memo
end
end
end
end
ock_param - вот что мне нужноDS
A
h
DS
h
h
DS
h
DS
VL
VL
h
DS
h
DS
h
DS