From: ahoward Date: 2002-12-13T08:07:53+09:00 Subject: Re: Inheritance Question On Fri, 13 Dec 2002, Jim Freeze wrote: [snip] > How do I get self to be 'MyMatrix' so I can > chain methods, such as: > > m.inv.add_col(c) ? [snip] it looks like you can't because Matrix#to_f def to_f collect{|e| e.to_f} end Matrix#collect def collect rows = @rows.collect{|row| row.collect{|e| yield e}} Matrix.rows(rows, false) end so collect always returns a Matrix. i had a disscussion a while back about this sort of thing and would be very curious if you, or others, come up with a generic solution. -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================