-----Original Message-----
From: Peter Fitzgibbons [mailto:Peter.Fitzgibbons / lakewoodhomes.net] 
Sent: Tuesday, August 16, 2005 4:16 PM
To: ruby-talk ML
Subject: Array manipulations questions

I have an array :

a =
[ [10, 11], [20, 21],
  [12, 13], [22, 23],
  [30, 31], [40, 41],
  [32, 33], [42, 43] ]

I want to know how to manipulate the array to get :
a.grid(1)
==> [10, 11], [12, 13]
A.grid(2)
==> [20, 21], [22, 23]
A.grid(3)
==> [30, 31], [32, 33]
A.grid(4)
==> [40, 41], [42, 43]

B = a.grid(1)
==> [10, 11], [12, 13]
B[1][1]
==> 10
B[2][2]
==> 13

A.row(1)
==> [10, 11, 20, 21]

A.col(1)
==> [10, 12, 30, 32]


Many many thanks for your examples.


Peter J. Fitzgibbons
Applications Manager
Lakewood Homes - "The American Dream Builder"(r)
Peter.Fitzgibbons / Lakewoodhomes.net
(847) 884-8800 



============================
What I meant to use for the source array was :

a =
[ [10, 11, 20, 21],
  [12, 13, 22, 23],
  [30, 31, 40, 41],
  [32, 33, 42, 43] ]

Thanks for your help.

Peter J. Fitzgibbons
Applications Manager
Lakewood Homes - "The American Dream Builder"(r)
Peter.Fitzgibbons / Lakewoodhomes.net
(847) 884-8800