From: Robert Mela Date: 2006-06-08T23:05:38+09:00 Subject: Re: Easy question --------------090600050203000609010709 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit But doesn't that result in an iteration over the points array every time we want to get min/max values? Farrel Lifson wrote: > You could have functions that query the points in the system instead > of keeping track as you add them. > > def min_x > (@points.min{|a,b| a.x <=> b.x}).x > end > > def min_y > (@points.min{|a,b| a.y <=> b.y}).y > end > > def max_x > (@points.max{|a,b| a.x <=> b.x}.x > end > > def max_y > (@points.min{|a,b| a.y <=> b.y}).y > end > --------------090600050203000609010709 Content-Type: text/x-vcard; charset=utf-8; name="rmela.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="rmela.vcf" begin:vcard fn:Robert Mela n:Mela;Robert adr;dom:;;;Lexington;MA email;internet:rmela@rcn.com tel;cell:781-363-0982 x-mozilla-html:FALSE version:2.1 end:vcard --------------090600050203000609010709--