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}} set aList to {{{1, 2}, {3, 4}, {5, 6, 4}}, {{1, 2}, {3, 4, 5, 6}, {{1, 2}, {3, 4, 5}, {16, 0, 0}}}} set aRes to countEveryItemOf2DArray(aList) of me –> 21 on countEveryItemOf2DArray(aList) set bList to FlattenList(aList) of me return (length of bList) end countEveryItemOf2DArray –By Paul Berkowitz –2009年1月27日 2:24:08:JST –Re: Flattening Nested Lists on FlattenList(aList) set oldDelims to AppleScript’s text item delimiters set AppleScript’s text item delimiters to {"????"} set aString to aList as text set aList to text items of aString set AppleScript’s text item delimiters to oldDelims return aList end FlattenList |
More from my site
(Visited 15 times, 1 visits today)