module Enumerable
file: rxraw-lineparser.rb
Public Instance Methods
repeated_permutation(size, &blk)
click to toggle source
# File lib/rxraw-lineparser.rb, line 6 def repeated_permutation(size, &blk) f = proc do |memo, &blk| if memo.size == size blk.call memo else self.each do |i| f.call memo + [i], &blk end end end if block_given? f.call [], &blk else Enumerator.new(f, :call, []) end end