どこまでもHashが出てくるHash
Rubyで。
class InfinityHash < Hash def initialize super {|hash,key| hash[key] = InfinityHash.new } end end hash = InfinityHash.new p hash[1][2][3][4][5][6][7][8] #=> {}
Rubyで。
class InfinityHash < Hash def initialize super {|hash,key| hash[key] = InfinityHash.new } end end hash = InfinityHash.new p hash[1][2][3][4][5][6][7][8] #=> {}