On Feb 26, 2007, at 11:48 AM, James Edward Gray II wrote:

> On Feb 26, 2007, at 8:45 AM, Rafael George wrote:
>
>> passvalues = []
>> i = 0
>> IO.foreach(fsource) do |line|
>> cols = []
>> cols=CSV::parse_line line.chomp
>> sourceval = cols[scomp_args[0]] + " " + cols[scomp_args[1]]
>>  IO.foreach(tdest) do |line|
>>    tcols = []
>>    tcols=CSV::parse_line line.chomp
>>    testval = tcols[tcomp_args[0]] + " " + tcols[tcomp_args[1]]
>>    if sourceval == testval
>>      passvalues[i] = sourceval
>>      i += 1
>>   end
>>  end
>> end
>
> The direct translation of this code to FasterCSV is:
>
> passvalues = Array.new
> FCSV.foreach(fsource) |s_row|
>   source = s_row[scomp_args[0]..scomp_args[1]].join(" ")
>   FCSV.foreach(tdest) |t_row|
>     if source == t_row[scomp_args[0]..scomp_args[1]].join(" ")
>       passvalues << source

       break  # performance enhancement

>     end
>   end
> end

James Edward Gray II