On Sun, Nov 8, 2009 at 7:40 PM, Timo Jeranko <jeranko / gmail.com> wrote:
> At the moment I'm doing something like this:
>
> def some_method(array1)
> ..
>  
> ..
>  
> ..
>  
> ..
> end
>
>
> I would like array1 to remain unchanged. It seems a little inefficient
> to clone array1 every time some_method is called.  
> elegant solution?
>

Couldn't you do something like this?

arr1 = ("a".."j").to_a
i = 3
p arr1[0...i]+arr1[i+1..-1]    #> ["a", "b", "c", "e", "f", "g", "h", "i", "j"]


Harry
-- 
A Look into Japanese Ruby List in English
http://www.kakueki.com/ruby/list.html