Subject: Re: Grouping elements of an array?
From: "Sam Kong" <sam.s.kong gmail.com>
Date: Mon, 8 Jan 2007 17:12:12 +0900
References: 233070233073233080
In-reply-to: 233080
Hi William,
William James wrote:
> Without "require":
> [ 1, 2, 3, 4, 5, 6, 7, 8 ].inject([[]]){|a,e|
> a << [] if a.last.size==3; a.last << e; a}
This looks really clever.
I like it.
Sam