From: Marcelo Alvim Date: 2006-08-07T05:43:21+09:00 Subject: Re: Iterating over an array n element at a time Hi, Sorry about the real newbie interrupting the high level thread, but... I liked very much the "eachn" method from Martin, and decided to test it out. I got a "Undefined method 'each_slice'" for the array. Went to ruby-doc.org, and the core docs have each_slice defined in module Enumerable. I have Ruby 1.8.4 installed. Does anyone know why is that not working for me? Thanks, Marcelo Alvim. > Kim Pedersen wrote: >> Is there an elegant way to iterate over an array n elements at a time? >> e.g. something like... >> >> a = [1,1,1,2,2,2,3,3,3] >> >> a.each(3) do |x,y,z| >> print x,y,z,"\n" >> end >> >> prints... >> 111 >> 222 >> 333