On 2004.03.03, Brad Chick <[EMAIL PROTECTED]> wrote:
>
> the values in array 'foo' are sums of donations. I need to pull out the
> highest 10 values. So I need to have the numeric values sorted descending,
> from highest to lowest.
proc sortNsvByValue {array a b} {
expr {[nsv_get $array $a] > [nsv_get $array $b]}
}
set values [list]
foreach {key value} [nsv_array get foo] {
lappend values $value
}
set topTen [lrange [lsort -decreasing $values] 0 9]
Like that?
-- Dossy
--
Dossy Shiobara mail: [EMAIL PROTECTED]
Panoptic Computer Network web: http://www.panoptic.com/
"He realized the fastest way to change is to laugh at your own
folly -- then you can let go and quickly move on." (p. 70)
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of
your email blank.