AppleScript名:1D Listをユニーク化 v2 |
— Created 2014-11-25 by Takaaki Naganoya — 2014 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" –set aList to {{aName:"Apple", aNum:1}, {aName:"Orange", aNum:1}, {aName:"Apple", aNum:1}} set aList to {1, 1, 1, 3} set aRes to uniquify1DList(aList, true) –> {1, 10, 90, 100, 300} –1D/2D Listをユニーク化 on uniquify1DList(theList as list, aBool as boolean) set aArray to current application’s NSArray’s arrayWithArray:theList set bArray to aArray’s valueForKeyPath:"@distinctUnionOfObjects.self" if aBool = true then return bArray as list else return bArray end if end uniquify1DList |
More from my site
(Visited 50 times, 1 visits today)