This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View 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

View 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)