On 2/13/07, WKC CCC <wai-kee.chung / uk.bnpparibas.com> wrote:
> Is there a fast way to return a subsection of an array object as there
> is  the minor function for a Matrix?
>
> For example
>  testArray = [[1,2,3,4,5],
>               [7,8,9,10,11]]
>
> How can the elements [[4,5],[10,11]] be extracted?
>
> Thanks,
>

testArray.map {|x| x[-2..-1]}

I don't know if it is "fast", but it was certainly quick to write ;)

Blessings,
TwP