Previous | Index | Next |
List manipulation methods
sumMaxMinOf:error:
Returns an array of {sum, max, min} of the list.
+ (NSArray *)sumMaxMinOf:(NSArray *)listOrArray error:(NSError *__autoreleasing *)outError
listOrArray = list or array of numbers
outError = missing value or reference
Array of the sum, the maximum and the minimum values
Version 1.0.0
If you set outError to reference, the result will be a list of two items. If there is no error, the first item will be the result of the method and the second will be missing value. If there is an error, the first item will be missing value and the second item with be an NSError.
use scripting additions
use framework "Foundation"
use script "BridgePlus"
load framework
set listOrArray to {1.1, 2, 3, 4, 5, 6, 5, 4, 3}
set theResult to current application's SMSForder's sumMaxMinOf:listOrArray |error|:(missing value)
ASify from theResult
--> {33.1, 6.0, 1.1}
theResult as list -- 10.11 only
--> {33.1, 6.0, 1.1}
theResult as list -- 10.9 and 10.10
--> {33.099998474121, 6.0, 1.100000023842}