Hello --
On Tue, 27 Feb 2001, Jeremy Nelson wrote:

> Here is the implementation I'm currently using for a 2d array.  This
> is different from the last one i posted because this one takes a yield
> block and can be used for ... interesting default assignments. =)
> 
> class Matrix < Array
>         def initialize (rows, columns)
>                 super(rows)
>                 self.each_index { |i| 
>                         self[i] = Array.new(columns) 
>                         self[i].each_index { |j| self[i][j] = yield i, j}
>                 }
>         end
> end
> 
> Specifically, what I have done with the above is:
> 
> 	a = Matrix.new(10, 10) { TkVariable.new() }
> 
> To get a 10x10 two-dimensional array of TkVariables (suitable for binding
> into Tk Widgets, of course. =)

Hmmm.... looks like something you could do with the Matrix package shipped
with Ruby :-)

Try this:

  require 'matrix'
  a = Matrix.I(10).map { TKVariable.new() }


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav