Sha256: 1c79a3bf853311fd7d767758d1dffcce0fe86038d11dfdf3d16efab75ef9319e

Contents?: true

Size: 212 Bytes

Versions: 4

Compression:

Stored size: 212 Bytes

Contents

module Sbuilder
    
  module Powerset

    # @see http://www.entish.org/wordpress/?p=676
    def self.powerset( arr )
        return arr.inject([[]]){|c,y|c.inject([]){|r,i|r+=[i,i+[y]]}}
      end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tla-sbuilder-0.3.9 lib/utils/powerset.rb
tla-sbuilder-0.3.8 lib/utils/powerset.rb
tla-sbuilder-0.3.7 lib/utils/powerset.rb
tla-sbuilder-0.3.4 lib/utils/powerset.rb