the array at with_object collects the elements but:
[1,3,10,5].each_cons(2).map{|x,y| y - x} #=> [2, 7, -5]

works fine too

-- 
Posted via http://www.ruby-forum.com/.