# -*- mode: icon -*-
# $Id: hash2.icon,v 1.1 2000/12/30 06:30:12 doug Exp $
# http://www.bagley.org/~doug/shootout/

procedure main(argv)
    n := argv[1] | 1
    hash1 := table(0)
    hash2 := table(0)
    every i := 0 to 10000 do {
    hash1["foo_"||string(i)] := i
    }
    every i := 1 to n do
    every k := key(hash1) do
        hash2[k] +:= hash1[k]
    write(hash1["foo_1"], " ", hash1["foo_9999"], " ",
      hash2["foo_1"], " ", hash2["foo_9999"])
end