[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Kinda quiet

Patrick Spence

11/6/2006 4:17:00 PM

Is it my imagination, or are things getting really quiet in this forum?
It seems that the "movers and shakers" in this forum have moved on to
better digs.

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

12 Answers

Phlip

11/6/2006 4:27:00 PM

0

Patrick Spence wrote:

> Is it my imagination, or are things getting really quiet in this forum?
> It seems that the "movers and shakers" in this forum have moved on to
> better digs.

All the fuss is on various forums discussing individual Ruby projects.

Put another way, one wouldn't want to post here if one of those forums were
on-topic. Also, you might get flamed for posting here if one of those forums
were on-topic.

--
Phlip
http://www.greencheese.u... <-- NOT a blog!!!


Justin Collins

11/7/2006 4:22:00 AM

0

Patrick Spence wrote:
> Is it my imagination, or are things getting really quiet in this forum?
> It seems that the "movers and shakers" in this forum have moved on to
> better digs.

It's quiet because emails from the mailing list aren't coming through.
I've sent Andreas an email about it.

Now, not to get too high up on my soapbox here, but: if you notice
something like this, please say something. The forums are generally a
more newbie-oriented place, and it does no one any good to have people
who are checking out Ruby feel like their messages are going unanswered.
If we want to maintain Ruby's friendly community (I certainly do:
remember "Matz is nice so we are nice"?), then, regardless of how some
of you might feel about the forums, we should at least let Andreas know
when the link appears to be down.

Okay, off the soapbox now.

-Justin

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

Brad Tilley

11/7/2006 1:15:00 PM

0

Say I have an array that contains 144 strings. I want to divide the array into
12 sub-arrays each containing 12 strings. What is the Ruby Way of doing this?
I've looked at slice array[0..11] etc, but that seems a bit clunky.

Thank you,
Brad

Jano Svitok

11/7/2006 1:21:00 PM

0

On 11/7/06, Brad Tilley <rtilley@vt.edu> wrote:
> Say I have an array that contains 144 strings. I want to divide the array into
> 12 sub-arrays each containing 12 strings. What is the Ruby Way of doing this?
> I've looked at slice array[0..11] etc, but that seems a bit clunky.
>
> Thank you,
> Brad
>

require 'enumerator'

ret = []
array.each_slice(12) {|a| ret << a}

Xavier Noria

11/7/2006 1:25:00 PM

0

On Nov 7, 2006, at 2:14 PM, Brad Tilley wrote:

> Say I have an array that contains 144 strings. I want to divide the
> array into
> 12 sub-arrays each containing 12 strings. What is the Ruby Way of
> doing this?
> I've looked at slice array[0..11] etc, but that seems a bit clunky.

If those are the 12 natural consecutive sub-arrays:

require 'enumerator'

array.each_slice(12) do |x|
# ...
end

-- fxn


Farrel Lifson

11/7/2006 1:27:00 PM

0

On 07/11/06, Brad Tilley <rtilley@vt.edu> wrote:
> Say I have an array that contains 144 strings. I want to divide the array into
> 12 sub-arrays each containing 12 strings. What is the Ruby Way of doing this?
> I've looked at slice array[0..11] etc, but that seems a bit clunky.
>
> Thank you,
> Brad

require 'enumerator'
numbers = Array(0..143)
numbers.enum_slice(12).inject([]) do |array,slice|
array << slice
end

Farrel

dblack

11/7/2006 1:28:00 PM

0

Pit Capitain

11/7/2006 1:51:00 PM

0

Farrel Lifson schrieb:
> On 07/11/06, Brad Tilley <rtilley@vt.edu> wrote:
>> Say I have an array that contains 144 strings. I want to divide the
>> array into
>> 12 sub-arrays each containing 12 strings. What is the Ruby Way of
>> doing this?
>> I've looked at slice array[0..11] etc, but that seems a bit clunky.
>
> require 'enumerator'
> numbers = Array(0..143)
> numbers.enum_slice(12).inject([]) do |array,slice|
> array << slice
> end

require "enumerator"
numbers = Array(0..143)
numbers.enum_slice(12).to_a

Regards,
Pit

Farrel Lifson

11/7/2006 2:04:00 PM

0

On 07/11/06, Pit Capitain <pit@capitain.de> wrote:
> Farrel Lifson schrieb:
> > On 07/11/06, Brad Tilley <rtilley@vt.edu> wrote:
> >> Say I have an array that contains 144 strings. I want to divide the
> >> array into
> >> 12 sub-arrays each containing 12 strings. What is the Ruby Way of
> >> doing this?
> >> I've looked at slice array[0..11] etc, but that seems a bit clunky.
> >
> > require 'enumerator'
> > numbers = Array(0..143)
> > numbers.enum_slice(12).inject([]) do |array,slice|
> > array << slice
> > end
>
> require "enumerator"
> numbers = Array(0..143)
> numbers.enum_slice(12).to_a
>
> Regards,
> Pit

That's pretty cool

Robert Klemme

11/7/2006 2:16:00 PM

0

On 07.11.2006 14:21, Jan Svitok wrote:
> On 11/7/06, Brad Tilley <rtilley@vt.edu> wrote:
>> Say I have an array that contains 144 strings. I want to divide the
>> array into
>> 12 sub-arrays each containing 12 strings. What is the Ruby Way of
>> doing this?
>> I've looked at slice array[0..11] etc, but that seems a bit clunky.
>
> require 'enumerator'
>
> ret = []
> array.each_slice(12) {|a| ret << a}

require 'enumerator'

arr = Array.new 144, "x"
ret = arr.to_enum(:each_slice, 12).inject([]) {|a, *x| a << x}

Kind regards

robert