require 'drb/drb'
require 'drb/rinda'

uri = ARGV.shift || raise("usage: #{$0} <server_uri>")

DRb.start_service
tuple = TupleSpaceProxy.new(DRbObject.new(nil, uri))

tuples = (1..10).collect do |n|
  ['sum', DRb.uri, n]
end

tuple.out(*tuples)

(1..10).each do |n|
  ans = tuple.in(['ans', DRb.uri, n, nil])
  p [ans[2], ans[3]]
end

