Is it at all possible to select the tallest from a group of boxes with randomly generated heights?

Sounds simple, but I've not been able to figure it out.

I've written a script that generates a field of boxes with a default height & a probability factor for each box to deviate from this height - I would like, upon each iteration of the script for the default height to be replaced by the tallest of the group, to yield an ever-escalating group of mutating boxes.

The # of boxes is variable & infinite, so I need a wildcard "select $Box*.height maximum" - type deal.

Thanks for your help..

focomoso

01-17-2008, 09:17 PM

amax (for b in $Box* collect b.height) -- but it would be faster to keep track of the tallest one while you create the boxes

Somakai

01-17-2008, 10:11 PM

holy crap; you're a lifesaver..

but what exactly do you mean "keep track of the tallest one while you create the boxes"?

efficiency is of upmost importance here, as this script will be used to generate mass quantities of these little boxes.