-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstatic.lua
More file actions
63 lines (51 loc) · 954 Bytes
/
static.lua
File metadata and controls
63 lines (51 loc) · 954 Bytes
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--- Static companions of array methods.
-- Modules --
local array = require("impl.array")
-- Imports --
local Call = array.Call
local IsArray = array.IsArray
-- Exports --
local M = {}
--
local function Eval1 (a, b, c, d, e, f)
a:eval()
if b then
return Eval1(b, c, d, e, f)
end
end
--
function M.Add (into)
for k, v in pairs{
--
eval = function(a, b, c, d, e, f)
if IsArray(f) then
Eval1(a, b, c, d, e, f)
elseif IsArray(e) then
Eval1(a, b, c, d, e)
elseif IsArray(d) then
Eval1(a, b, c, d)
elseif IsArray(c) then
Eval1(a, b, c)
elseif IsArray(b) then
Eval1(a, b)
else
a:eval()
return a
end
end,
--
getDims = function(arr, out)
out = out or {}
out[1], out[2], out[3], out[4] = Call("af_get_dims", arr:get())
return out
end,
--
numDims = function(arr)
return Call("af_get_numdims", arr:get())
end,
} do
into[k] = v
end
end
-- Export the module.
return M