1 | test_tensor = ->
|
2 | run_test [
|
3 |
|
4 | "[[a]]",
|
5 | "[[a]]",
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | "[[1,0],[0,0]]",
|
12 | "[[1,0],[0,0]]",
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | "rank(a)",
|
27 | "0",
|
28 |
|
29 | "rank([a,b,c])",
|
30 | "1",
|
31 |
|
32 | "shape([a,b,c])",
|
33 | "[3]",
|
34 |
|
35 | "rank([[a,b,c]])",
|
36 | "2",
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | "shape([[a,b,c]])",
|
42 | "[1,3]",
|
43 |
|
44 | "rank([[a],[b],[c]])",
|
45 | "2",
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | "shape([[a],[b],[c]])",
|
51 | "[3,1]",
|
52 |
|
53 | "rank([[[a,b,c]]])",
|
54 | "3",
|
55 |
|
56 | "shape([[[a,b,c]]])",
|
57 | "[1,1,3]",
|
58 |
|
59 | "rank([[[a],[b],[c]]])",
|
60 | "3",
|
61 |
|
62 | "shape([[[a],[b],[c]]])",
|
63 | "[1,3,1]",
|
64 |
|
65 | "rank([[[a]],[[b]],[[c]]])",
|
66 | "3",
|
67 |
|
68 | "shape([[[a]],[[b]],[[c]]])",
|
69 | "[3,1,1]",
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | "a=[1,2,3]",
|
77 | "",
|
78 |
|
79 | "rank(a)",
|
80 | "1",
|
81 |
|
82 | "b=[4,5,6]",
|
83 | "",
|
84 |
|
85 | "c=[7,8,9]",
|
86 | "",
|
87 |
|
88 | "rank([a,b,c])",
|
89 | "2",
|
90 |
|
91 | "[a,b,c]",
|
92 | "[[1,2,3],[4,5,6],[7,8,9]]",
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 | "f(x) = x + 1",
|
106 | "",
|
107 |
|
108 | "a=[1,f,3]",
|
109 | "",
|
110 |
|
111 | "a[2]",
|
112 | "function (x) -> x+1",
|
113 |
|
114 | "a[f(1)]",
|
115 | "function (x) -> x+1",
|
116 |
|
117 | "a[a[f(1)](1)]",
|
118 | "function (x) -> x+1",
|
119 |
|
120 | "a[2](9)",
|
121 | "10",
|
122 |
|
123 | "a[f(1)](f(8))",
|
124 | "10",
|
125 |
|
126 | "a[a[f(1)](1)](a[f(1)](8))",
|
127 | "10",
|
128 |
|
129 |
|
130 |
|
131 | "g(x) = x + 1",
|
132 | "",
|
133 |
|
134 | "f() = [1,g,3]",
|
135 | "",
|
136 |
|
137 | "a=[1,f,3]",
|
138 | "",
|
139 |
|
140 | "a[2]()[2](7)",
|
141 | "8",
|
142 |
|
143 |
|
144 |
|
145 | "g(x) = x + 1",
|
146 | "",
|
147 |
|
148 | "f() = [[1,g,3],[0,0,0],[0,0,0]]",
|
149 | "",
|
150 |
|
151 | "a=[1,f,3]",
|
152 | "",
|
153 |
|
154 | "a[2]()[1][2](8)",
|
155 | "9",
|
156 |
|
157 | "(a[2]())[1][2](8)",
|
158 | "9",
|
159 |
|
160 | "((a[2]())[1])[2](8)",
|
161 | "9",
|
162 |
|
163 | "(((a[2]())[1])[2])(8)",
|
164 | "9",
|
165 |
|
166 | "(((a[a[1]+a[1]]())[a[1]])[a[1]+a[1]])(8)",
|
167 | "9",
|
168 |
|
169 | "f()[1][2](8)",
|
170 | "9",
|
171 |
|
172 | "f()[a[1]][a[1]+a[1]](8)",
|
173 | "9",
|
174 |
|
175 |
|
176 |
|
177 | "g(x) = transpose(x)",
|
178 | "",
|
179 |
|
180 | "f() = [[1,g,3],[0,0,0],[0,0,0]]",
|
181 | "",
|
182 |
|
183 | "a=[1,f,3]",
|
184 | "",
|
185 |
|
186 | "a[2]()[1][2]([[1,2,3,4]])",
|
187 | "[[1],[2],[3],[4]]",
|
188 |
|
189 |
|
190 |
|
191 | "unit(x)",
|
192 | "unit(x)",
|
193 |
|
194 | "unit(3)",
|
195 | "[[1,0,0],[0,1,0],[0,0,1]]",
|
196 |
|
197 | "unit(1)",
|
198 | "[[1]]",
|
199 |
|
200 |
|
201 |
|
202 | "a=quote(a)",
|
203 | "",
|
204 |
|
205 | "b=quote(b)",
|
206 | "",
|
207 |
|
208 | "c=quote(c)",
|
209 | "",
|
210 |
|
211 | "f=quote(f)",
|
212 | "",
|
213 |
|
214 | "g=quote(g)",
|
215 | "",
|
216 | ]
|