-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathfunctional-ce.lua
More file actions
38 lines (38 loc) · 1.8 KB
/
functional-ce.lua
File metadata and controls
38 lines (38 loc) · 1.8 KB
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 = functional.range(int to)
table t = functional.range(int from, int to)
table t = functional.range(int from, int to, int step)
table ft = functional.map(function f, table t, ...)
any v = functional.reduce(function f, table t, any initial)
table ft = functional.filter(function f, table t)
functional.foreach(function f, ...)
any v = functional.identity(any v)
table tz = functional.zip(table t1, table t2, ...)
function nf = functional.negate(function f)
... = functional.apply(function f, ...)
function pf = functional.partial(function f, ...)
bool b = functional.any(function f, table t)
bool b = functional.all(function f, table t)
function iterFunc = functional.iter(table t)
string funcName = functional.reify(function f, string name)
number y = functional.operator.add(number a, number b)
number y = functional.operator.sub(number a, number b)
number y = functional.operator.mul(number a, number b)
number y = functional.operator.div(number a, number b)
number y = functional.operator.mod(number a, number b)
number y = functional.operator.idiv(number a, number b)
number y = functional.operator.pow(number a, number b)
number y = functional.operator.land(number a, number b)
number y = functional.operator.lor(number a, number b)
number y = functional.operator.lxor(number a, number b)
number y = functional.operator.lshl(number a, number b)
number y = functional.operator.lshr(number a, number b)
bool b = functional.operator.eq(number a, number b)
bool b = functional.operator.neq(number a, number b)
bool b = functional.operator.gt(number a, number b)
bool b = functional.operator.ge(number a, number b)
bool b = functional.operator.lt(number a, number b)
bool b = functional.operator.le(number a, number b)
number s = functional.sum(table t)
number p = functional.prod(table t)
]])