ruby hicscore.rb <lab0.datgives the output in lab0.out.
class Pair attr_reader :x, :y attr_writer :x, :y # two Pairs are defined to be the same if their products are: def ==(other) @x * @y == other.x * other.y end endUsing it:
irb(main):042:0> a = Pair.new; a.x = 5; a.y = 6 => 6 irb(main):043:0> b = Pair.new; b.x = 3; b.y = 10 => 10 irb(main):044:0> a == b => true irb(main):045:0> b.y = 9 => 9 irb(main):046:0> a == b => false
p = Promise.new { puts '>>>> evaluating <<<<'; 5 * 5 } p p.force p.force p.to_s