A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
6
Task/Filter/AppleScript/filter-1.applescript
Normal file
6
Task/Filter/AppleScript/filter-1.applescript
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
set array to {1, 2, 3, 4, 5, 6}
|
||||
set evens to {}
|
||||
repeat with i in array
|
||||
if (i mod 2 = 0) then set end of evens to i's contents
|
||||
end repeat
|
||||
return evens
|
||||
17
Task/Filter/AppleScript/filter-2.applescript
Normal file
17
Task/Filter/AppleScript/filter-2.applescript
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
to filter(inList, acceptor)
|
||||
set outList to {}
|
||||
repeat with anItem in inList
|
||||
if acceptor's accept(anItem) then
|
||||
set end of outList to contents of anItem
|
||||
end
|
||||
end
|
||||
return outList
|
||||
end
|
||||
|
||||
script isEven
|
||||
to accept(aNumber)
|
||||
aNumber mod 2 = 0
|
||||
end accept
|
||||
end script
|
||||
|
||||
filter({1,2,3,4,5,6}, isEven)
|
||||
Loading…
Add table
Add a link
Reference in a new issue