From: James Gray Date: 2008-03-26T23:42:16+09:00 Subject: Re: The inject function On Mar 26, 2008, at 9:35 AM, Radosław Bułat wrote: >> Second, I need to reverse an array using only the inject command. So, >> something like above with the result [4,3,2,1] > > Use .reverse method. inject doesn't fit in. I agree that reverse() is the correct tool for this job, but just to fully answer the question: >> [1, 2, 3, 4].inject([]) { |rev, item| [item] + rev } => [4, 3, 2, 1] James Edward Gray II