From: MonkeeSage Date: 2006-09-16T08:46:00+09:00 Subject: Re: arbitrary indexes MonkeeSage wrote: > The second implementation I posted allows for that. You could also do it like this, and preserve the default functionality but add the arbitrary indexing via passing an array: class Array alias :_sqr_accsr :[] def [](*args) if args.size == 1 and args.at(0).instance_of?(Array) values_at(*args.at(0)) else _sqr_accsr(*args) end end end a = [1,2,3,4,5,6,7,8,9] p a[2] # => 3 p a[2,4] # => [3, 4, 5, 6] p a[[2,4,6]] # => [3, 5, 7] The point is: _use_ the language to your advantage, don't fight against it. Regards, Jordan