-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathfunctional-ce.lua
38 lines (38 loc) · 1.41 KB
/
functional-ce.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
registerCodeEditorInfos('functional', [[
table t = range(int to)
table t = range(int from, int to)
table t = range(int from, int to, int step)
table ft = map(function f, table t, ...)
any v = reduce(function f, table t, any initial)
table ft = filter(function f, table t)
foreach(function f, ...)
any v = identity(any v)
table tz = zip(table t1, table t2, ...)
function nf = negate(function f)
... = apply(function f, ...)
function pf = partial(function f, ...)
bool b = any(function f, table t)
bool b = all(function f, table t)
function iterFunc = iter(table t)
string funcName = reify(function f, string name)
number y = operator.add(number a, number b)
number y = operator.sub(number a, number b)
number y = operator.mul(number a, number b)
number y = operator.div(number a, number b)
number y = operator.mod(number a, number b)
number y = operator.idiv(number a, number b)
number y = operator.pow(number a, number b)
number y = operator.land(number a, number b)
number y = operator.lor(number a, number b)
number y = operator.lxor(number a, number b)
number y = operator.lshl(number a, number b)
number y = operator.lshr(number a, number b)
bool b = operator.eq(number a, number b)
bool b = operator.neq(number a, number b)
bool b = operator.gt(number a, number b)
bool b = operator.ge(number a, number b)
bool b = operator.lt(number a, number b)
bool b = operator.le(number a, number b)
number s = sum(table t)
number p = prod(table t)
]])