> > I want to subtract the item(i) from item(i-1) of the array, a and return > a new array of the results. Below is my attempt. > > But, you are doing the opposite :) Anyway, based on your code, FWIW, here is another one-liner. Elegant? I don't know. b = Array.new(a.length){|i| a[i]-a[i-1]}[1..-1].unshift(a[0]) Harry -- A Look into Japanese Ruby List in English http://www.kakueki.com/ruby/list.html