From: ara.t.howard@... Date: 2006-12-03T02:54:01+09:00 Subject: Re: [OT] calculations on lists of numbers On Sun, 3 Dec 2006, Devin Mullins wrote: > ara.t.howard@noaa.gov wrote: >> harp:~> cat a.rb > Man, how do you keep all your a.rb's straight? > >> #! /dmsp/reference/bin/ruby >> >> require 'narray' >> require 'yaml' > Am I blind, or do you require 'yaml' and never use it? nope. you are note blind ;-) it used yaml in the past, but it's rolled by hand now to presever order... >> list = ARGF.readlines.map{|line| line.strip.split(%r/\s+/).map{|f| Float >> f}}.flatten > Doesn't this load the whole list of numbers into memory? (i.e. how does it > fare on "a billion values"? yes. badly. most of our machines have 8gb of ram though - so i can ignore this for most of our stuff ;-) mostly this is a small hack which levrages the power of narray. regards. -a -- if you want others to be happy, practice compassion. if you want to be happy, practice compassion. -- the dalai lama