[ruby-talk:02376] Iterator into array

From: Dave Thomas <Dave@...>
Date: 2000-04-07 16:12:52 UTC
List: ruby-talk #2376
Dave's stupid question of the week:

Given an iterator method, how can I get the results expressed as an
array? I could do:

  result = []
  iteratorMethod { |i| result << i }

But this seems ugly - there must be a more functional way of doing this. Any
ideas? 


Dave

In This Thread

Prev Next