AppleScript名:JTHistogramでArrayのヒストグラムを計算 |
— Created 2017-08-01 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "JTHistogramKit" –https://github.com/Kinokoo/JTHistogram –http://piyocast.com/as/archives/4757 set anArray to current application’s NSMutableArray’s arrayWithArray:{1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3} set histObj to current application’s JTHistogram’s alloc()’s initWithArray:anArray set histDict to histObj’s |histogram|() –> (NSDictionary) {0:0, 3:4, 2:2, 1:6} set relativeHistogramDict to histObj’s relativeHistogram() –> (NSDictionary) {0:0, 3:66.66667, 2:33.33334, 1:100} |
More from my site
(Visited 22 times, 1 visits today)