"Akinori MUSHA" <knu / idaemons.org> writes:

> What is 'iteratorMethod { |i| result << i }' supposed to do?

This is an old thread. I was looking for a simple way to generate an
array containing the results  yielded by an iterator without
pre-allocating an array. Say 'randGen' generated 'n' random numbers,

   randGen(100) {|i| puts i |

and I wanted the results sorted. It would be nice to be able to do:

  randGen(100) [] .sort

or somesuch to take the iterator results and stick them straight in an 
array. I'm getting to like the more functional style of expressing
things ;-)


Dave