AppleScript名:2Dリスト内の要素の平均値を求める |
— Created 2017-10-01 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set aList to {{1, 2, 3, 4, 5, 6, 4}, {1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 16, 0, 0}} –7,6, 8 items set aRes to getAverageValueFrom2DArray(aList) of me –> 4 –average value is 0 on getAverageValueFrom2DArray(aList) set anArray to current application’s NSArray’s arrayWithArray:aList set eRes to (anArray’s valueForKeyPath:"@unionOfArrays.self")’s valueForKeyPath:"@avg.self" return eRes as integer end getAverageValueFrom2DArray |
More from my site
(Visited 31 times, 1 visits today)