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: Alex Zavatone <email@hidden>
- Date: Tue, 14 Sep 2010 12:40:18 -0500
FWIW, here's my "not terribly elegant" solution that I wrote yesterday.
For paranoia's sake, I used copy, but I'm sure a set will do the trick.
Please feel free to modify to your heart's content.
Cheers, - Alex
on GetMinimum(myList) if myList = {} then return set myMinimum to missing value repeat with myItem in myList if myItem < myMinimum or myMinimum = missing value then copy myItem to myMinimum end repeat return myMinimum end GetMinimum
on GetMaximum(myList) if myList = {} then return set myMaximum to missing value repeat with myItem in myList if myItem > myMaximum or myMaximum = missing value then copy myItem to myMaximum end repeat return myMaximum end GetMaximum |
_______________________________________________
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