Sha256: b913b02e678e0a01f2e3329bdae66aca0b7698c24c6479f6dc6d29bbbc71ac1a

Contents?: true

Size: 479 Bytes

Versions: 2

Compression:

Stored size: 479 Bytes

Contents

class Skynet
  class MapreduceTest
    include SkynetDebugger
    
    def self.map(datas)
      results = {}
      datas.each do |data|
        results[data] ||= 0
        results[data] += 1
      end                 
      [results]      
    end
    
    def self.reduce(datas)
      results = {}
      datas.each do |hashes|
        hashes.each do |key,value|
          results[key] ||= 0
          results[key] += value
        end
      end
      results
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
skynet-0.9.1 lib/skynet/mapreduce_test.rb
skynet-0.9.2 lib/skynet/mapreduce_test.rb