text
stringlengths
0
15.7k
source
stringlengths
6
112
tell the result to repeat with x in its list
+arrays.applescript
if my __(function)'s fn(x, L, R) then set ¬
+arrays.applescript
end of its result to x's contents
+arrays.applescript
R
+arrays.applescript
end filterItems
+arrays.applescript
to foldItems from L at |ξ| : 0 given handler:function
+arrays.applescript
local L, |ξ|, function
+arrays.applescript
tell the result's list to repeat with i from 1 to its length
+arrays.applescript
set x to its item i
+arrays.applescript
tell my __(function)'s fn(x, |ξ|, i, L)
+arrays.applescript
if it = null then exit repeat
+arrays.applescript
set |ξ| to it
+arrays.applescript
end foldItems
+arrays.applescript
to replaceItems from |L₂| as list : {} into |L₁| as list at index : 0
+arrays.applescript
local xs, L, index
+arrays.applescript
set N to |L₁|'s length
+arrays.applescript
set i to (index + N + 1) mod (N + 1)
+arrays.applescript
if i = 0 then set i to N + 1
+arrays.applescript
property list : |L₁|
+arrays.applescript
property xs : |L₂|
+arrays.applescript
repeat with x in its xs
+arrays.applescript
if i ≤ N then
+arrays.applescript
set its list's item i to x's contents
+arrays.applescript
set end of its list to x's contents
+arrays.applescript
return its list
+arrays.applescript
end replaceItems
+arrays.applescript
to pushItems onto L as list at i as integer : 0 given list:A as list : {}
+arrays.applescript
local L, i, A
+arrays.applescript
property xs : A
+arrays.applescript
property N : L's length
+arrays.applescript
property index : (i + N + 1) mod (N + 1)
+arrays.applescript
set i to its index
+arrays.applescript
set its list to its list & its xs
+arrays.applescript
else if i = 1 then
+arrays.applescript
set its list to its xs & its list
+arrays.applescript
set its list to ¬
+arrays.applescript
(its list's items 1 thru (i - 1)) & ¬
+arrays.applescript
(its xs) & ¬
+arrays.applescript
(its list's items i thru -1)
+arrays.applescript
end pushItems
+arrays.applescript
on difference(A as list, B as list)
+arrays.applescript
local A, B
+arrays.applescript
on notMember(M)
+arrays.applescript
on fn(x)
+arrays.applescript
x is not in M
+arrays.applescript
end notMember
+arrays.applescript
filterItems from A given handler:result's notMember(B)
+arrays.applescript
end difference
+arrays.applescript
on intersection(A as list, B as list)
+arrays.applescript
on member(M)
+arrays.applescript
x is in M
+arrays.applescript
filterItems from A given handler:result's member(B)
+arrays.applescript
end intersection
+arrays.applescript
on union(A as list, B as list)
+arrays.applescript
on insert(x, L)
+arrays.applescript
set end of L to x
+arrays.applescript
end insert
+arrays.applescript
foldItems from A at B given handler:result's insert
+arrays.applescript
on unique:L
+arrays.applescript
local L
+arrays.applescript
on notMember(x, i, L)
+arrays.applescript
x is not in L
+arrays.applescript
filterItems from L given handler:result's notMember
+arrays.applescript
end unique:
+arrays.applescript
to zip(A, B)
+arrays.applescript
to concat(x, |ξ|, i)
+arrays.applescript
set item i of |ξ| to {} & item i of |ξ| & x as list
+arrays.applescript
end concat
+arrays.applescript
foldItems from B at A given handler:result's concat
+arrays.applescript
to multiply(x, L)
+arrays.applescript
set unary to L's class ≠ list
+arrays.applescript
to multiplyBy:x
+arrays.applescript
on fn(y)
+arrays.applescript
x * y
+arrays.applescript
end multiplyBy:
+arrays.applescript
set R to mapItems from L given handler:result's multiplyBy:x
+arrays.applescript
if unary then set [R] to R
+arrays.applescript
end multiply
+arrays.applescript
to add(x, L)
+arrays.applescript
to add:x
+arrays.applescript
x + y
+arrays.applescript
end add:
+arrays.applescript
set R to mapItems from L given handler:result's add:x
+arrays.applescript
on sum:L
+arrays.applescript
foldItems from L given handler:add
+arrays.applescript
end sum:
+arrays.applescript
on product:L
+arrays.applescript
foldItems from L at 1 given handler:multiply
+arrays.applescript
end product:
+arrays.applescript
on max:L
+arrays.applescript
on maximum(x, y)
+arrays.applescript
if x ≥ y then return x
+arrays.applescript
foldItems from L given handler:result's maximum
+arrays.applescript
end max:
+arrays.applescript
on min:L
+arrays.applescript
on minimum(x, y)
+arrays.applescript
if x ≤ y then return x
+arrays.applescript
foldItems from L at L's first item given handler:result's minimum
+arrays.applescript
end min:
+arrays.applescript
on mean:L
+arrays.applescript