Common list elements: Difference between revisions

Added AppleScript.
m (→‎Excel LAMBDA: Simplified one expression)
(Added AppleScript.)
Line 17:
<lang APL> ∩/ (2 5 1 3 8 9 4 6) (3 5 6 2 9 8 4) (1 3 7 9 6)
3 9 6 </lang>
 
=={{header|AppleScript}}==
<lang>use AppleScript version "2.4" -- OS X 10.10 (Yosemite) or later
use framework "Foundation"
 
on commonListElements(listOfNumberLists)
set mutableSet to current application's class "NSMutableSet"'s setWithArray:(beginning of listOfNumberLists)
repeat with i from 2 to (count listOfNumberLists)
tell mutableSet to intersectSet:(current application's class "NSSet"'s setWithArray:(item i of listOfNumberLists))
end repeat
set sortDescriptor to current application's class "NSSortDescriptor"'s sortDescriptorWithKey:("self") ¬
ascending:(true)
return (mutableSet's sortedArrayUsingDescriptors:({sortDescriptor})) as list
end commonListElements
 
commonListElements({{2, 5, 1, 3, 8, 9, 4, 6}, {3, 5, 6, 2, 9, 8, 4}, {1, 3, 7, 6, 9}})</lang>
 
{{output}}
<lang applescript>{3, 6, 9}</lang>
 
=={{header|AutoHotkey}}==
557

edits