Unrelated to your question, your code example made me curious:
class Bitvector < Array
def initialize(*)
@a = super
end
def to_s
# convert Bitvector, ordered lsb to msb,
# to string of 0s and 1s, ordered msb to lsb
@a.map{|i| i.to_s(2)}.reverse.join
end
end
Q: Is there any benefit to storing a copy of self in @a? Is there any
drawback to eliminating the initialize definition in the child class
and replacing the "@a" in the to_s method with "self"? What am I
missing?
Wondering,
Aaron out.