Re: Getting the maximum value and minimal values in a list
Re: Getting the maximum value and minimal values in a list
- Subject: Re: Getting the maximum value and minimal values in a list
- From: Emmanuel LEVY <email@hidden>
- Date: Tue, 14 Sep 2010 16:58:15 +0200
You don't have to write your own, but instead you would have to use
stuff written by others.
Such as, the Satimage osax, which provides the "statlist" command,
which returns the min and the max (and more) of a list.
Emmanuel
On Sep 13, 2010, at 11:31 PM, Alex Zavatone wrote:
Awesome. Thanks man. Sucks that we have to write our own, but hey,
it is what it is.
On Sep 13, 2010, at 3:35 PM, KOENIG Yvan wrote:
Le 13 sept. 2010 à 22:21, Alex Zavatone a écrit :
I've been looking around and can't seem to find a way to return
the maximum and minimal values in a list.
Is this something supported by Applescript or something I'll have
to write myself?
There isn't such a function in AppleScript.
set list_of_values to {10, 20, 30, 40, 50, 60, 2000, 9, 3000, 4}
set minimum to 9.9999999999E+12
set maximum to 0
repeat with ref_to_value in list_of_values
set the_value to contents of ref_to_value
if the_value > maximum then set maximum to the_value
if the_value < minimum then set minimum to the_value
end repeat
{minimum, maximum}
may do the trick.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden