Entries from 2012-02-28 to 1 day

パイの計算

class Pai < Hash def initialize(params) params.keys.each do |key| self[key] = params[key] end end def +(other) keys = (self.keys + other.keys).uniq keys.inject(Pai.new({})) do |result, key| result[key] = (self[key] || 0) + (other[key] || 0…