text
stringlengths
0
15.7k
source
stringlengths
6
112
repeat with i from 1 to (count every person)
update-address-book.scpt
set phoneProperties to properties of phones of person i
update-address-book.scpt
repeat with j from 1 to (count of phoneProperties)
update-address-book.scpt
if value of item j of phoneProperties contains "019" then
update-address-book.scpt
set phoneNumber to value of item j of phoneProperties
update-address-book.scpt
set the phoneNumber to replace_chars(phoneNumber, "019", "+") of me
update-address-book.scpt
log phoneNumber
update-address-book.scpt
set value of item j of phones of person i to phoneNumber
update-address-book.scpt
with properties {name:"New to do", due date:current date}
CreateTodo.applescript
property name : "arrays"
+arrays.applescript
property id : "chri.sk.applescript.lib:arrays"
+arrays.applescript
property version : 1.0
+arrays.applescript
to make N at x : null given pseudorandomness:random as boolean : false
+arrays.applescript
local N, x, random
+arrays.applescript
property list : {}
+arrays.applescript
tell the result
+arrays.applescript
if random then
+arrays.applescript
repeat with i from 1 to N
+arrays.applescript
set end of its list to random number to N
+arrays.applescript
else if x = null then
+arrays.applescript
set end of its list to i
+arrays.applescript
repeat N times
+arrays.applescript
set end of its list to x
+arrays.applescript
its list
+arrays.applescript
end make
+arrays.applescript
on array(N) -- Generates a list of integers from 1 to +N
+arrays.applescript
make N
+arrays.applescript
end array
+arrays.applescript
on emptyarray(N) -- Generates a list of +N missing values
+arrays.applescript
make N at missing value
+arrays.applescript
end emptyarray
+arrays.applescript
on offset of x in L
+arrays.applescript
local x, L
+arrays.applescript
if x is not in L then return {}
+arrays.applescript
on found(x)
+arrays.applescript
on fn(y, |ξ|, i)
+arrays.applescript
if y = x then set end of |ξ| to i
+arrays.applescript
|ξ|
+arrays.applescript
end fn
+arrays.applescript
end found
+arrays.applescript
foldItems from L at {} given handler:result's found(x)
+arrays.applescript
end offset
+arrays.applescript
on __(obj)
+arrays.applescript
local obj
+arrays.applescript
if the class of obj = handler then
+arrays.applescript
property fn : obj
+arrays.applescript
return the result
+arrays.applescript
else if the class of obj = list then
+arrays.applescript
property list : obj
+arrays.applescript
return a reference to the result's list
+arrays.applescript
return obj
+arrays.applescript
end __
+arrays.applescript
on iterate for N : 0 from y : 1 to max : null given handler:function
+arrays.applescript
property length : N
+arrays.applescript
property item : y
+arrays.applescript
property index : 0
+arrays.applescript
property func : function
+arrays.applescript
on x()
+arrays.applescript
tell my list
+arrays.applescript
set its end to its last item
+arrays.applescript
a reference to its last item
+arrays.applescript
end x
+arrays.applescript
to next()
+arrays.applescript
set index to index + 1
+arrays.applescript
if index = 1 then return my item
+arrays.applescript
tell __(func) to set my item to the ¬
+arrays.applescript
fn(my item, my index, my list)
+arrays.applescript
end next
+arrays.applescript
to yield(N)
+arrays.applescript
local N
+arrays.applescript
set end of my list to next()
+arrays.applescript
my list
+arrays.applescript
end yield
+arrays.applescript
on upto(max)
+arrays.applescript
local max
+arrays.applescript
if next() > max then return my list
+arrays.applescript
set end of my list to my item
+arrays.applescript
end upto
+arrays.applescript
if N > 0 then return its yield(N)
+arrays.applescript
if max ≠ null then return upto(max)
+arrays.applescript
it
+arrays.applescript
end iterate
+arrays.applescript
on generator(fn, y)
+arrays.applescript
iterate from y given handler:fn
+arrays.applescript
end generator
+arrays.applescript
to mapItems from L as list given handler:function
+arrays.applescript
local L, function
+arrays.applescript
property list : L
+arrays.applescript
tell (a reference to the result's list)
+arrays.applescript
repeat with i from 1 to its length
+arrays.applescript
set x to (a reference to its item i)
+arrays.applescript
copy fn(x's contents, i, it) ¬
+arrays.applescript
of my __(function) ¬
+arrays.applescript
to the contents of x
+arrays.applescript
L
+arrays.applescript
end mapItems
+arrays.applescript
to filterItems from L as list into R as list : null given handler:function
+arrays.applescript
local L, R
+arrays.applescript
if R = null then set R to {}
+arrays.applescript
property result : R
+arrays.applescript