@elaraai/east 1.0.80 → 1.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/builtins.d.ts +1 -1
- package/dist/src/builtins.d.ts.map +1 -1
- package/dist/src/builtins.js +19 -0
- package/dist/src/builtins.js.map +1 -1
- package/dist/src/codegen/spellings.d.ts.map +1 -1
- package/dist/src/codegen/spellings.js +3 -0
- package/dist/src/codegen/spellings.js.map +1 -1
- package/dist/src/comparison.d.ts +54 -0
- package/dist/src/comparison.d.ts.map +1 -1
- package/dist/src/comparison.equivalent.spec.d.ts +6 -0
- package/dist/src/comparison.equivalent.spec.d.ts.map +1 -0
- package/dist/src/comparison.equivalent.spec.js +130 -0
- package/dist/src/comparison.equivalent.spec.js.map +1 -0
- package/dist/src/comparison.js +93 -20
- package/dist/src/comparison.js.map +1 -1
- package/dist/src/compile/builtins/array.d.ts +2 -1
- package/dist/src/compile/builtins/array.d.ts.map +1 -1
- package/dist/src/compile/builtins/array.js +35 -0
- package/dist/src/compile/builtins/array.js.map +1 -1
- package/dist/src/compile/builtins/dict.d.ts +1 -0
- package/dist/src/compile/builtins/dict.d.ts.map +1 -1
- package/dist/src/compile/builtins/dict.js +25 -0
- package/dist/src/compile/builtins/dict.js.map +1 -1
- package/dist/src/compile/builtins/set.d.ts +1 -0
- package/dist/src/compile/builtins/set.d.ts.map +1 -1
- package/dist/src/compile/builtins/set.js +25 -0
- package/dist/src/compile/builtins/set.js.map +1 -1
- package/dist/src/compile/builtins/tree.d.ts +32 -0
- package/dist/src/compile/builtins/tree.d.ts.map +1 -0
- package/dist/src/compile/builtins/tree.js +108 -0
- package/dist/src/compile/builtins/tree.js.map +1 -0
- package/dist/src/compile/functions.d.ts.map +1 -1
- package/dist/src/compile/functions.js +4 -4
- package/dist/src/compile/functions.js.map +1 -1
- package/dist/src/compile/runtime.d.ts +12 -15
- package/dist/src/compile/runtime.d.ts.map +1 -1
- package/dist/src/compile/runtime.js +19 -16
- package/dist/src/compile/runtime.js.map +1 -1
- package/dist/src/compile.signature.spec.d.ts +6 -0
- package/dist/src/compile.signature.spec.d.ts.map +1 -0
- package/dist/src/compile.signature.spec.js +53 -0
- package/dist/src/compile.signature.spec.js.map +1 -0
- package/dist/src/expr/array.d.ts +158 -81
- package/dist/src/expr/array.d.ts.map +1 -1
- package/dist/src/expr/array.js +68 -51
- package/dist/src/expr/array.js.map +1 -1
- package/dist/src/expr/ast.d.ts.map +1 -1
- package/dist/src/expr/ast.js +13 -0
- package/dist/src/expr/ast.js.map +1 -1
- package/dist/src/expr/blob.d.ts +8 -8
- package/dist/src/expr/blob.js +8 -8
- package/dist/src/expr/block.d.ts +18 -5
- package/dist/src/expr/block.d.ts.map +1 -1
- package/dist/src/expr/block.js +19 -0
- package/dist/src/expr/block.js.map +1 -1
- package/dist/src/expr/boolean.d.ts +10 -10
- package/dist/src/expr/boolean.js +10 -10
- package/dist/src/expr/datetime.d.ts +28 -28
- package/dist/src/expr/datetime.js +28 -28
- package/dist/src/expr/dict.d.ts +101 -51
- package/dist/src/expr/dict.d.ts.map +1 -1
- package/dist/src/expr/dict.js +97 -36
- package/dist/src/expr/dict.js.map +1 -1
- package/dist/src/expr/float.d.ts +23 -23
- package/dist/src/expr/float.js +23 -23
- package/dist/src/expr/integer.d.ts +17 -17
- package/dist/src/expr/integer.js +11 -11
- package/dist/src/expr/libs/array.d.ts +6 -6
- package/dist/src/expr/libs/array.js +6 -6
- package/dist/src/expr/libs/blob.d.ts +2 -2
- package/dist/src/expr/libs/blob.js +2 -2
- package/dist/src/expr/libs/datetime.d.ts +25 -25
- package/dist/src/expr/libs/datetime.js +25 -25
- package/dist/src/expr/libs/dict.d.ts +2 -2
- package/dist/src/expr/libs/dict.js +2 -2
- package/dist/src/expr/libs/float.d.ts +15 -15
- package/dist/src/expr/libs/float.js +15 -15
- package/dist/src/expr/libs/integer.d.ts +12 -12
- package/dist/src/expr/libs/integer.js +12 -12
- package/dist/src/expr/libs/set.d.ts +2 -2
- package/dist/src/expr/libs/set.js +2 -2
- package/dist/src/expr/libs/string.d.ts +4 -4
- package/dist/src/expr/libs/string.js +4 -4
- package/dist/src/expr/recursive.d.ts +22 -5
- package/dist/src/expr/recursive.d.ts.map +1 -1
- package/dist/src/expr/recursive.js +22 -5
- package/dist/src/expr/recursive.js.map +1 -1
- package/dist/src/expr/ref.d.ts +5 -5
- package/dist/src/expr/ref.js +5 -5
- package/dist/src/expr/set.d.ts +96 -51
- package/dist/src/expr/set.d.ts.map +1 -1
- package/dist/src/expr/set.js +85 -29
- package/dist/src/expr/set.js.map +1 -1
- package/dist/src/expr/string.d.ts +28 -28
- package/dist/src/expr/string.js +28 -28
- package/dist/src/expr/struct.d.ts.map +1 -1
- package/dist/src/expr/struct.js +2 -2
- package/dist/src/expr/variant.d.ts +12 -12
- package/dist/src/expr/variant.js +7 -7
- package/dist/src/function_symbols.d.ts +28 -0
- package/dist/src/function_symbols.d.ts.map +1 -0
- package/dist/src/function_symbols.js +28 -0
- package/dist/src/function_symbols.js.map +1 -0
- package/dist/src/location.d.ts +32 -0
- package/dist/src/location.d.ts.map +1 -1
- package/dist/src/location.js +38 -0
- package/dist/src/location.js.map +1 -1
- package/dist/src/location.spec.js +89 -1
- package/dist/src/location.spec.js.map +1 -1
- package/dist/src/runner_protocol.d.ts +46 -5
- package/dist/src/runner_protocol.d.ts.map +1 -1
- package/dist/src/runner_protocol.js +24 -5
- package/dist/src/runner_protocol.js.map +1 -1
- package/dist/src/serialization/beast2/index.d.ts +1 -0
- package/dist/src/serialization/beast2/index.d.ts.map +1 -1
- package/dist/src/serialization/beast2/index.js +1 -0
- package/dist/src/serialization/beast2/index.js.map +1 -1
- package/dist/src/serialization/beast2/v5/canonical.d.ts +101 -0
- package/dist/src/serialization/beast2/v5/canonical.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/canonical.js +436 -0
- package/dist/src/serialization/beast2/v5/canonical.js.map +1 -0
- package/dist/src/serialization/beast2/v5/canonical.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/canonical.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/canonical.spec.js +124 -0
- package/dist/src/serialization/beast2/v5/canonical.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/elements.d.ts +3 -1
- package/dist/src/serialization/beast2/v5/elements.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/elements.js +7 -2
- package/dist/src/serialization/beast2/v5/elements.js.map +1 -1
- package/dist/src/serialization/beast2/v5/elements.spec.js +1 -1
- package/dist/src/serialization/beast2/v5/elements.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/intake.d.ts +98 -0
- package/dist/src/serialization/beast2/v5/intake.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/intake.js +462 -0
- package/dist/src/serialization/beast2/v5/intake.js.map +1 -0
- package/dist/src/serialization/beast2/v5/intake.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/intake.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/intake.spec.js +202 -0
- package/dist/src/serialization/beast2/v5/intake.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/runs.d.ts +6 -4
- package/dist/src/serialization/beast2/v5/runs.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/runs.js +31 -5
- package/dist/src/serialization/beast2/v5/runs.js.map +1 -1
- package/dist/src/serialization/beast2/v5/runs.spec.js +23 -3
- package/dist/src/serialization/beast2/v5/runs.spec.js.map +1 -1
- package/dist/src/serialization/index.d.ts +1 -1
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/serialization/index.js +1 -1
- package/dist/src/serialization/index.js.map +1 -1
- package/package.json +1 -1
package/dist/src/expr/array.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
5
|
import type { AST } from "../ast.js";
|
|
6
|
-
import { ArrayType, BooleanType, FunctionType, IntegerType, NullType, StringType, NeverType, OptionType, StructType, VariantType, SetType, FloatType, DictType, type ValueTypeOf, type SubType } from "../types.js";
|
|
6
|
+
import { ArrayType, BooleanType, FunctionType, IntegerType, NullType, StringType, type EastType, NeverType, OptionType, StructType, VariantType, SetType, FloatType, DictType, type ValueTypeOf, type SubType } from "../types.js";
|
|
7
7
|
import type { IntegerExpr } from "./integer.js";
|
|
8
8
|
import type { NullExpr } from "./null.js";
|
|
9
9
|
import { Expr, type ToExpr } from "./expr.js";
|
|
@@ -57,7 +57,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
57
57
|
* const getSize = East.function([ArrayType(IntegerType)], IntegerType, ($, arr) => {
|
|
58
58
|
* $.return(arr.size());
|
|
59
59
|
* });
|
|
60
|
-
* const compiled = East.compile(getSize
|
|
60
|
+
* const compiled = East.compile(getSize, []);
|
|
61
61
|
* compiled([1n, 2n, 3n]); // 3n
|
|
62
62
|
* compiled([]); // 0n
|
|
63
63
|
* ```
|
|
@@ -73,7 +73,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
73
73
|
* const getLength = East.function([ArrayType(IntegerType)], IntegerType, ($, arr) => {
|
|
74
74
|
* $.return(arr.length());
|
|
75
75
|
* });
|
|
76
|
-
* const compiled = East.compile(getLength
|
|
76
|
+
* const compiled = East.compile(getLength, []);
|
|
77
77
|
* compiled([1n, 2n, 3n]); // 3n
|
|
78
78
|
* compiled([]); // 0n
|
|
79
79
|
* ```
|
|
@@ -90,7 +90,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
90
90
|
* const hasElement = East.function([ArrayType(IntegerType), IntegerType], BooleanType, ($, arr, index) => {
|
|
91
91
|
* $.return(arr.has(index));
|
|
92
92
|
* });
|
|
93
|
-
* const compiled = East.compile(hasElement
|
|
93
|
+
* const compiled = East.compile(hasElement, []);
|
|
94
94
|
* compiled([10n, 20n, 30n], 1n); // true
|
|
95
95
|
* compiled([10n, 20n, 30n], 5n); // false
|
|
96
96
|
* compiled([10n, 20n, 30n], -1n); // false
|
|
@@ -111,7 +111,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
111
111
|
* const getElement = East.function([ArrayType(IntegerType), IntegerType], IntegerType, ($, arr, index) => {
|
|
112
112
|
* $.return(arr.get(index));
|
|
113
113
|
* });
|
|
114
|
-
* const compiled = East.compile(getElement
|
|
114
|
+
* const compiled = East.compile(getElement, []);
|
|
115
115
|
* compiled([10n, 20n, 30n], 1n); // 20n
|
|
116
116
|
* // compiled([10n, 20n, 30n], 5n) would throw error
|
|
117
117
|
*
|
|
@@ -119,7 +119,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
119
119
|
* const getOrDefault = East.function([ArrayType(IntegerType), IntegerType], IntegerType, ($, arr, index) => {
|
|
120
120
|
* $.return(arr.get(index, ($, i) => -1n));
|
|
121
121
|
* });
|
|
122
|
-
* compiled = East.compile(getOrDefault
|
|
122
|
+
* compiled = East.compile(getOrDefault, []);
|
|
123
123
|
* compiled([10n, 20n, 30n], 5n); // -1n (out of bounds)
|
|
124
124
|
* ```
|
|
125
125
|
*/
|
|
@@ -138,7 +138,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
138
138
|
* const getElement = East.function([ArrayType(IntegerType), IntegerType], IntegerType, ($, arr, index) => {
|
|
139
139
|
* $.return(arr.get(index));
|
|
140
140
|
* });
|
|
141
|
-
* const compiled = East.compile(getElement
|
|
141
|
+
* const compiled = East.compile(getElement, []);
|
|
142
142
|
* compiled([10n, 20n, 30n], 1n); // 20n
|
|
143
143
|
* // compiled([10n, 20n, 30n], 5n) would throw error
|
|
144
144
|
*
|
|
@@ -146,7 +146,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
146
146
|
* const getOrDefault = East.function([ArrayType(IntegerType), IntegerType], IntegerType, ($, arr, index) => {
|
|
147
147
|
* $.return(arr.get(index, ($, i) => -1n));
|
|
148
148
|
* });
|
|
149
|
-
* compiled = East.compile(getOrDefault
|
|
149
|
+
* compiled = East.compile(getOrDefault, []);
|
|
150
150
|
* compiled([10n, 20n, 30n], 5n); // -1n (out of bounds)
|
|
151
151
|
* ```
|
|
152
152
|
*/
|
|
@@ -162,7 +162,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
162
162
|
* const tryGetElement = East.function([ArrayType(IntegerType), IntegerType], OptionType(IntegerType), ($, arr, index) => {
|
|
163
163
|
* $.return(arr.tryGet(index));
|
|
164
164
|
* });
|
|
165
|
-
* const compiled = East.compile(tryGetElement
|
|
165
|
+
* const compiled = East.compile(tryGetElement, []);
|
|
166
166
|
* compiled([10n, 20n, 30n], 1n); // {_tag: "some", some: 20n}
|
|
167
167
|
* compiled([10n, 20n, 30n], 5n); // {_tag: "none", none: null}
|
|
168
168
|
* ```
|
|
@@ -183,7 +183,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
183
183
|
* $(arr.update(index, value)); // Mutate the array
|
|
184
184
|
* $.return(arr);
|
|
185
185
|
* });
|
|
186
|
-
* const compiled = East.compile(updateElement
|
|
186
|
+
* const compiled = East.compile(updateElement, []);
|
|
187
187
|
* compiled([10n, 20n, 30n], 1n, 99n); // [10n, 99n, 30n]
|
|
188
188
|
* ```
|
|
189
189
|
*/
|
|
@@ -207,7 +207,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
207
207
|
* $(arr.pushLast(value)); // Mutate the array
|
|
208
208
|
* $.return(arr);
|
|
209
209
|
* });
|
|
210
|
-
* const compiled = East.compile(appendValue
|
|
210
|
+
* const compiled = East.compile(appendValue, []);
|
|
211
211
|
* compiled([1n, 2n, 3n], 4n); // [1n, 2n, 3n, 4n]
|
|
212
212
|
* ```
|
|
213
213
|
*/
|
|
@@ -224,7 +224,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
224
224
|
* const removeLastValue = East.function([ArrayType(IntegerType)], IntegerType, ($, arr) => {
|
|
225
225
|
* $.return(arr.popLast());
|
|
226
226
|
* });
|
|
227
|
-
* const compiled = East.compile(removeLastValue
|
|
227
|
+
* const compiled = East.compile(removeLastValue, []);
|
|
228
228
|
* compiled([1n, 2n, 3n]); // 3n (arr is now [1n, 2n])
|
|
229
229
|
* ```
|
|
230
230
|
*/
|
|
@@ -241,7 +241,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
241
241
|
* $(arr.pushFirst(value)); // Mutate the array
|
|
242
242
|
* $.return(arr);
|
|
243
243
|
* });
|
|
244
|
-
* const compiled = East.compile(prependValue
|
|
244
|
+
* const compiled = East.compile(prependValue, []);
|
|
245
245
|
* compiled([1n, 2n, 3n], 0n); // [0n, 1n, 2n, 3n]
|
|
246
246
|
* ```
|
|
247
247
|
*/
|
|
@@ -258,7 +258,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
258
258
|
* const removeFirstValue = East.function([ArrayType(IntegerType)], IntegerType, ($, arr) => {
|
|
259
259
|
* $.return(arr.popFirst());
|
|
260
260
|
* });
|
|
261
|
-
* const compiled = East.compile(removeFirstValue
|
|
261
|
+
* const compiled = East.compile(removeFirstValue, []);
|
|
262
262
|
* compiled([1n, 2n, 3n]); // 1n (arr is now [2n, 3n])
|
|
263
263
|
* ```
|
|
264
264
|
*/
|
|
@@ -275,7 +275,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
275
275
|
* $(arr1.append(arr2)); // Mutate arr1
|
|
276
276
|
* $.return(arr1);
|
|
277
277
|
* });
|
|
278
|
-
* const compiled = East.compile(appendArray
|
|
278
|
+
* const compiled = East.compile(appendArray, []);
|
|
279
279
|
* compiled([1n, 2n], [3n, 4n]); // [1n, 2n, 3n, 4n]
|
|
280
280
|
* ```
|
|
281
281
|
*/
|
|
@@ -292,7 +292,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
292
292
|
* $(arr1.prepend(arr2)); // Mutate arr1
|
|
293
293
|
* $.return(arr1);
|
|
294
294
|
* });
|
|
295
|
-
* const compiled = East.compile(prependArray
|
|
295
|
+
* const compiled = East.compile(prependArray, []);
|
|
296
296
|
* compiled([3n, 4n], [1n, 2n]); // [1n, 2n, 3n, 4n]
|
|
297
297
|
* ```
|
|
298
298
|
*/
|
|
@@ -312,7 +312,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
312
312
|
* arr1.mergeAll(arr2, ($, current, other, index) => current.add(other));
|
|
313
313
|
* $.return(null);
|
|
314
314
|
* });
|
|
315
|
-
* const compiled = East.compile(mergeArrays
|
|
315
|
+
* const compiled = East.compile(mergeArrays, []);
|
|
316
316
|
* const arr1 = [10n, 20n, 30n];
|
|
317
317
|
* const arr2 = [1n, 2n, 3n];
|
|
318
318
|
* compiled(arr1, arr2); // null (arr1 is now [11n, 22n, 33n])
|
|
@@ -325,7 +325,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
325
325
|
* arr1.mergeAll(arr2, ($, current, other, index) => current.concat(" + ").concat(other));
|
|
326
326
|
* $.return(arr1);
|
|
327
327
|
* });
|
|
328
|
-
* const compiled = East.compile(mergeStrings
|
|
328
|
+
* const compiled = East.compile(mergeStrings, []);
|
|
329
329
|
* compiled(["a", "b"], ["x", "y"]); // ["a + x", "b + y"]
|
|
330
330
|
* ```
|
|
331
331
|
*/
|
|
@@ -341,7 +341,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
341
341
|
* arr.clear();
|
|
342
342
|
* $.return(arr);
|
|
343
343
|
* });
|
|
344
|
-
* const compiled = East.compile(clearArray
|
|
344
|
+
* const compiled = East.compile(clearArray, []);
|
|
345
345
|
* compiled([1n, 2n, 3n]); // []
|
|
346
346
|
* ```
|
|
347
347
|
*/
|
|
@@ -361,7 +361,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
361
361
|
* arr.sortInPlace();
|
|
362
362
|
* $.return(arr);
|
|
363
363
|
* });
|
|
364
|
-
* const compiled = East.compile(sortNumbers
|
|
364
|
+
* const compiled = East.compile(sortNumbers, []);
|
|
365
365
|
* compiled([3n, 1n, 4n, 1n, 5n]); // [1n, 1n, 3n, 4n, 5n]
|
|
366
366
|
* ```
|
|
367
367
|
*
|
|
@@ -373,7 +373,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
373
373
|
* people.sortInPlace(($, p) => p.age);
|
|
374
374
|
* $.return(people);
|
|
375
375
|
* });
|
|
376
|
-
* const compiled = East.compile(sortByAge
|
|
376
|
+
* const compiled = East.compile(sortByAge, []);
|
|
377
377
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]);
|
|
378
378
|
* // [{ name: "Bob", age: 25n }, { name: "Alice", age: 30n }]
|
|
379
379
|
* ```
|
|
@@ -396,7 +396,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
396
396
|
* const sortNumbers = East.function([ArrayType(IntegerType)], ArrayType(IntegerType), ($, arr) => {
|
|
397
397
|
* $.return(arr.sort());
|
|
398
398
|
* });
|
|
399
|
-
* const compiled = East.compile(sortNumbers
|
|
399
|
+
* const compiled = East.compile(sortNumbers, []);
|
|
400
400
|
* compiled([3n, 1n, 4n, 1n, 5n]); // [1n, 1n, 3n, 4n, 5n]
|
|
401
401
|
* ```
|
|
402
402
|
*
|
|
@@ -407,7 +407,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
407
407
|
* const sortByAgeDesc = East.function([ArrayType(PersonType)], ArrayType(PersonType), ($, people) => {
|
|
408
408
|
* $.return(people.sort(($, p) => p.age.negate()));
|
|
409
409
|
* });
|
|
410
|
-
* const compiled = East.compile(sortByAgeDesc
|
|
410
|
+
* const compiled = East.compile(sortByAgeDesc, []);
|
|
411
411
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]);
|
|
412
412
|
* // [{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]
|
|
413
413
|
* ```
|
|
@@ -426,7 +426,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
426
426
|
* arr.reverseInPlace();
|
|
427
427
|
* $.return(arr);
|
|
428
428
|
* });
|
|
429
|
-
* const compiled = East.compile(reverseArray
|
|
429
|
+
* const compiled = East.compile(reverseArray, []);
|
|
430
430
|
* compiled([1n, 2n, 3n, 4n, 5n]); // [5n, 4n, 3n, 2n, 1n]
|
|
431
431
|
* ```
|
|
432
432
|
*
|
|
@@ -446,7 +446,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
446
446
|
* const reverseArray = East.function([ArrayType(StringType)], ArrayType(StringType), ($, arr) => {
|
|
447
447
|
* $.return(arr.reverse());
|
|
448
448
|
* });
|
|
449
|
-
* const compiled = East.compile(reverseArray
|
|
449
|
+
* const compiled = East.compile(reverseArray, []);
|
|
450
450
|
* compiled(["a", "b", "c"]); // ["c", "b", "a"]
|
|
451
451
|
* ```
|
|
452
452
|
*
|
|
@@ -464,7 +464,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
464
464
|
* const checkSorted = East.function([ArrayType(IntegerType)], BooleanType, ($, arr) => {
|
|
465
465
|
* $.return(arr.isSorted());
|
|
466
466
|
* });
|
|
467
|
-
* const compiled = East.compile(checkSorted
|
|
467
|
+
* const compiled = East.compile(checkSorted, []);
|
|
468
468
|
* compiled([1n, 2n, 3n, 4n]); // true
|
|
469
469
|
* compiled([1n, 3n, 2n, 4n]); // false
|
|
470
470
|
* ```
|
|
@@ -476,7 +476,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
476
476
|
* const checkSortedByAge = East.function([ArrayType(PersonType)], BooleanType, ($, people) => {
|
|
477
477
|
* $.return(people.isSorted(($, p) => p.age));
|
|
478
478
|
* });
|
|
479
|
-
* const compiled = East.compile(checkSortedByAge
|
|
479
|
+
* const compiled = East.compile(checkSortedByAge, []);
|
|
480
480
|
* compiled([{ name: "Bob", age: 25n }, { name: "Alice", age: 30n }]); // true
|
|
481
481
|
* ```
|
|
482
482
|
*/
|
|
@@ -497,7 +497,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
497
497
|
* const findFirst = East.function([ArrayType(IntegerType), IntegerType], IntegerType, ($, arr, value) => {
|
|
498
498
|
* $.return(arr.findSortedFirst(value));
|
|
499
499
|
* });
|
|
500
|
-
* const compiled = East.compile(findFirst
|
|
500
|
+
* const compiled = East.compile(findFirst, []);
|
|
501
501
|
* compiled([1n, 3n, 5n, 7n, 9n], 5n); // 2n (index of 5)
|
|
502
502
|
* compiled([1n, 3n, 5n, 7n, 9n], 4n); // 2n (index where 4 would be inserted)
|
|
503
503
|
* compiled([1n, 3n, 5n, 7n, 9n], 10n); // 5n (out of bounds)
|
|
@@ -510,7 +510,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
510
510
|
* const findByAge = East.function([ArrayType(PersonType), IntegerType], IntegerType, ($, people, age) => {
|
|
511
511
|
* $.return(people.findSortedFirst(age, ($, p) => p.age));
|
|
512
512
|
* });
|
|
513
|
-
* const compiled = East.compile(findByAge
|
|
513
|
+
* const compiled = East.compile(findByAge, []);
|
|
514
514
|
* // Assumes people array is sorted by age
|
|
515
515
|
* compiled([{ name: "Bob", age: 25n }, { name: "Alice", age: 30n }], 28n); // 1n
|
|
516
516
|
* ```
|
|
@@ -532,7 +532,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
532
532
|
* const findLast = East.function([ArrayType(IntegerType), IntegerType], IntegerType, ($, arr, value) => {
|
|
533
533
|
* $.return(arr.findSortedLast(value));
|
|
534
534
|
* });
|
|
535
|
-
* const compiled = East.compile(findLast
|
|
535
|
+
* const compiled = East.compile(findLast, []);
|
|
536
536
|
* compiled([1n, 3n, 5n, 7n, 9n], 5n); // 2n (index of 5)
|
|
537
537
|
* compiled([1n, 3n, 5n, 7n, 9n], 6n); // 2n (index of last element <= 6)
|
|
538
538
|
* compiled([1n, 3n, 5n, 7n, 9n], 0n); // -1n (all elements are greater)
|
|
@@ -555,7 +555,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
555
555
|
* const findRange = East.function([ArrayType(IntegerType), IntegerType], StructType({ start: IntegerType, end: IntegerType }), ($, arr, value) => {
|
|
556
556
|
* $.return(arr.findSortedRange(value));
|
|
557
557
|
* });
|
|
558
|
-
* const compiled = East.compile(findRange
|
|
558
|
+
* const compiled = East.compile(findRange, []);
|
|
559
559
|
* compiled([1n, 3n, 5n, 5n, 5n, 7n, 9n], 5n); // { start: 2n, end: 5n }
|
|
560
560
|
* compiled([1n, 3n, 5n, 7n, 9n], 4n); // { start: 2n, end: 2n } (not found)
|
|
561
561
|
* ```
|
|
@@ -579,7 +579,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
579
579
|
* const sliceArray = East.function([ArrayType(IntegerType), IntegerType, IntegerType], ArrayType(IntegerType), ($, arr, start, end) => {
|
|
580
580
|
* $.return(arr.slice(start, end));
|
|
581
581
|
* });
|
|
582
|
-
* const compiled = East.compile(sliceArray
|
|
582
|
+
* const compiled = East.compile(sliceArray, []);
|
|
583
583
|
* compiled([10n, 20n, 30n, 40n, 50n], 1n, 4n); // [20n, 30n, 40n]
|
|
584
584
|
* compiled([10n, 20n, 30n, 40n, 50n], 0n, 2n); // [10n, 20n]
|
|
585
585
|
* ```
|
|
@@ -599,7 +599,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
599
599
|
* const concatArrays = East.function([ArrayType(IntegerType), ArrayType(IntegerType)], ArrayType(IntegerType), ($, arr1, arr2) => {
|
|
600
600
|
* $.return(arr1.concat(arr2));
|
|
601
601
|
* });
|
|
602
|
-
* const compiled = East.compile(concatArrays
|
|
602
|
+
* const compiled = East.compile(concatArrays, []);
|
|
603
603
|
* compiled([1n, 2n, 3n], [4n, 5n]); // [1n, 2n, 3n, 4n, 5n]
|
|
604
604
|
* ```
|
|
605
605
|
*/
|
|
@@ -618,7 +618,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
618
618
|
* const getMultiple = East.function([ArrayType(StringType), ArrayType(IntegerType)], ArrayType(StringType), ($, arr, indices) => {
|
|
619
619
|
* $.return(arr.getKeys(indices));
|
|
620
620
|
* });
|
|
621
|
-
* const compiled = East.compile(getMultiple
|
|
621
|
+
* const compiled = East.compile(getMultiple, []);
|
|
622
622
|
* compiled(["a", "b", "c", "d"], [0n, 2n, 3n]); // ["a", "c", "d"]
|
|
623
623
|
* ```
|
|
624
624
|
*
|
|
@@ -628,7 +628,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
628
628
|
* const getWithDefault = East.function([ArrayType(IntegerType), ArrayType(IntegerType)], ArrayType(IntegerType), ($, arr, indices) => {
|
|
629
629
|
* $.return(arr.getKeys(indices, ($, key) => -1n));
|
|
630
630
|
* });
|
|
631
|
-
* const compiled = East.compile(getWithDefault
|
|
631
|
+
* const compiled = East.compile(getWithDefault, []);
|
|
632
632
|
* compiled([10n, 20n, 30n], [1n, 5n, 2n]); // [20n, -1n, 30n]
|
|
633
633
|
* ```
|
|
634
634
|
*/
|
|
@@ -648,7 +648,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
648
648
|
* });
|
|
649
649
|
* $.return(null);
|
|
650
650
|
* });
|
|
651
|
-
* const compiled = East.compile(forEachExample
|
|
651
|
+
* const compiled = East.compile(forEachExample, [log.implement(console.log)]);
|
|
652
652
|
* compiled([10n, 20n, 30n]);
|
|
653
653
|
* // Logs: "Index 0: 10", "Index 1: 20", "Index 2: 30"
|
|
654
654
|
* ```
|
|
@@ -669,7 +669,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
669
669
|
* copy.pushLast(99n);
|
|
670
670
|
* $.return(copy);
|
|
671
671
|
* });
|
|
672
|
-
* const compiled = East.compile(copyArray
|
|
672
|
+
* const compiled = East.compile(copyArray, []);
|
|
673
673
|
* const original = [1n, 2n, 3n];
|
|
674
674
|
* compiled(original); // [1n, 2n, 3n, 99n]
|
|
675
675
|
* // original is unchanged: [1n, 2n, 3n]
|
|
@@ -687,7 +687,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
687
687
|
* const doubleNumbers = East.function([ArrayType(IntegerType)], ArrayType(IntegerType), ($, arr) => {
|
|
688
688
|
* $.return(arr.map(($, x, i) => x.multiply(2n)));
|
|
689
689
|
* });
|
|
690
|
-
* const compiled = East.compile(doubleNumbers
|
|
690
|
+
* const compiled = East.compile(doubleNumbers, []);
|
|
691
691
|
* compiled([1n, 2n, 3n, 4n]); // [2n, 4n, 6n, 8n]
|
|
692
692
|
* ```
|
|
693
693
|
*
|
|
@@ -697,7 +697,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
697
697
|
* const numbersToStrings = East.function([ArrayType(IntegerType)], ArrayType(StringType), ($, arr) => {
|
|
698
698
|
* $.return(arr.map(($, x, i) => Expr.str`Number: ${x}`));
|
|
699
699
|
* });
|
|
700
|
-
* const compiled = East.compile(numbersToStrings
|
|
700
|
+
* const compiled = East.compile(numbersToStrings, []);
|
|
701
701
|
* compiled([10n, 20n]); // ["Number: 10", "Number: 20"]
|
|
702
702
|
* ```
|
|
703
703
|
*
|
|
@@ -708,7 +708,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
708
708
|
* const getNames = East.function([ArrayType(PersonType)], ArrayType(StringType), ($, people) => {
|
|
709
709
|
* $.return(people.map(($, p, i) => p.name));
|
|
710
710
|
* });
|
|
711
|
-
* const compiled = East.compile(getNames
|
|
711
|
+
* const compiled = East.compile(getNames, []);
|
|
712
712
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]); // ["Alice", "Bob"]
|
|
713
713
|
* ```
|
|
714
714
|
*/
|
|
@@ -725,7 +725,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
725
725
|
* const filterEven = East.function([ArrayType(IntegerType)], ArrayType(IntegerType), ($, arr) => {
|
|
726
726
|
* $.return(arr.filter(($, x, i) => x.modulo(2n).equal(0n)));
|
|
727
727
|
* });
|
|
728
|
-
* const compiled = East.compile(filterEven
|
|
728
|
+
* const compiled = East.compile(filterEven, []);
|
|
729
729
|
* compiled([1n, 2n, 3n, 4n, 5n, 6n]); // [2n, 4n, 6n]
|
|
730
730
|
* ```
|
|
731
731
|
*
|
|
@@ -735,7 +735,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
735
735
|
* const filterFirstThree = East.function([ArrayType(StringType)], ArrayType(StringType), ($, arr) => {
|
|
736
736
|
* $.return(arr.filter(($, elem, index) => index.lessThan(3n)));
|
|
737
737
|
* });
|
|
738
|
-
* const compiled = East.compile(filterFirstThree
|
|
738
|
+
* const compiled = East.compile(filterFirstThree, []);
|
|
739
739
|
* compiled(["a", "b", "c", "d", "e"]); // ["a", "b", "c"]
|
|
740
740
|
* ```
|
|
741
741
|
*
|
|
@@ -746,7 +746,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
746
746
|
* const filterAdults = East.function([ArrayType(PersonType)], ArrayType(PersonType), ($, people) => {
|
|
747
747
|
* $.return(people.filter(($, p, i) => p.age.greaterOrEqual(18n)));
|
|
748
748
|
* });
|
|
749
|
-
* const compiled = East.compile(filterAdults
|
|
749
|
+
* const compiled = East.compile(filterAdults, []);
|
|
750
750
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 15n }]); // [{ name: "Alice", age: 30n }]
|
|
751
751
|
* ```
|
|
752
752
|
*/
|
|
@@ -768,7 +768,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
768
768
|
* return $.if(num.isNone(), () => Expr.none, () => Expr.some(num.unwrap()));
|
|
769
769
|
* }));
|
|
770
770
|
* });
|
|
771
|
-
* const compiled = East.compile(parseSafe
|
|
771
|
+
* const compiled = East.compile(parseSafe, []);
|
|
772
772
|
* compiled(["10", "not-a-number", "20", "30"]); // [10n, 20n, 30n]
|
|
773
773
|
* ```
|
|
774
774
|
*
|
|
@@ -781,7 +781,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
781
781
|
* $.if(p.active, () => Expr.some(p.name.toUpperCase()), () => Expr.none)
|
|
782
782
|
* ));
|
|
783
783
|
* });
|
|
784
|
-
* const compiled = East.compile(getActiveNames
|
|
784
|
+
* const compiled = East.compile(getActiveNames, []);
|
|
785
785
|
* compiled([
|
|
786
786
|
* { name: "Alice", age: 30n, active: true },
|
|
787
787
|
* { name: "Bob", age: 25n, active: false },
|
|
@@ -820,7 +820,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
820
820
|
* const findValue = East.function([ArrayType(IntegerType), IntegerType], OptionType(IntegerType), ($, arr, val) => {
|
|
821
821
|
* $.return(arr.findFirst(val));
|
|
822
822
|
* });
|
|
823
|
-
* const compiled = East.compile(findValue
|
|
823
|
+
* const compiled = East.compile(findValue, []);
|
|
824
824
|
* compiled([10n, 20n, 30n, 20n], 20n); // .some(1n)
|
|
825
825
|
* compiled([10n, 20n, 30n], 99n); // .none
|
|
826
826
|
* ```
|
|
@@ -832,7 +832,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
832
832
|
* const findByAge = East.function([ArrayType(PersonType), IntegerType], OptionType(IntegerType), ($, people, targetAge) => {
|
|
833
833
|
* $.return(people.findFirst(targetAge, ($, p, i) => p.age));
|
|
834
834
|
* });
|
|
835
|
-
* const compiled = East.compile(findByAge
|
|
835
|
+
* const compiled = East.compile(findByAge, []);
|
|
836
836
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }], 25n); // .some(1n)
|
|
837
837
|
* ```
|
|
838
838
|
*
|
|
@@ -856,7 +856,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
856
856
|
* const findAllValues = East.function([ArrayType(IntegerType), IntegerType], ArrayType(IntegerType), ($, arr, val) => {
|
|
857
857
|
* $.return(arr.findAll(val));
|
|
858
858
|
* });
|
|
859
|
-
* const compiled = East.compile(findAllValues
|
|
859
|
+
* const compiled = East.compile(findAllValues, []);
|
|
860
860
|
* compiled([10n, 20n, 30n, 20n, 10n], 20n); // [1n, 3n]
|
|
861
861
|
* compiled([10n, 20n, 30n], 99n); // []
|
|
862
862
|
* ```
|
|
@@ -868,7 +868,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
868
868
|
* const findByRole = East.function([ArrayType(PersonType), StringType], ArrayType(IntegerType), ($, people, targetRole) => {
|
|
869
869
|
* $.return(people.findAll(targetRole, ($, p, i) => p.role));
|
|
870
870
|
* });
|
|
871
|
-
* const compiled = East.compile(findByRole
|
|
871
|
+
* const compiled = East.compile(findByRole, []);
|
|
872
872
|
* compiled([
|
|
873
873
|
* { name: "Alice", role: "admin" },
|
|
874
874
|
* { name: "Bob", role: "user" },
|
|
@@ -900,7 +900,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
900
900
|
* const sumArray = East.function([ArrayType(IntegerType)], IntegerType, ($, arr) => {
|
|
901
901
|
* $.return(arr.reduce(($, acc, val, index) => acc.add(val), 0n));
|
|
902
902
|
* });
|
|
903
|
-
* const compiled = East.compile(sumArray
|
|
903
|
+
* const compiled = East.compile(sumArray, []);
|
|
904
904
|
* compiled([1n, 2n, 3n, 4n]); // 10n
|
|
905
905
|
* compiled([]); // 0n (initial value)
|
|
906
906
|
* ```
|
|
@@ -913,7 +913,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
913
913
|
* $.if(index.equal(0n), () => val, () => acc.concat(", ").concat(val))
|
|
914
914
|
* , ""));
|
|
915
915
|
* });
|
|
916
|
-
* const compiled = East.compile(joinArray
|
|
916
|
+
* const compiled = East.compile(joinArray, []);
|
|
917
917
|
* compiled(["a", "b", "c"]); // "a, b, c"
|
|
918
918
|
* ```
|
|
919
919
|
*
|
|
@@ -944,7 +944,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
944
944
|
* const runningTotal = East.function([ArrayType(IntegerType)], ArrayType(IntegerType), ($, arr) => {
|
|
945
945
|
* $.return(arr.scan(($, acc, x, i) => acc.add(x), 0n));
|
|
946
946
|
* });
|
|
947
|
-
* const compiled = East.compile(runningTotal
|
|
947
|
+
* const compiled = East.compile(runningTotal, []);
|
|
948
948
|
* compiled([1n, 2n, 3n, 4n]); // [1n, 3n, 6n, 10n]
|
|
949
949
|
* compiled([]); // []
|
|
950
950
|
* ```
|
|
@@ -955,7 +955,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
955
955
|
* const forwardFill = East.function([ArrayType(StringType)], ArrayType(StringType), ($, cells) => {
|
|
956
956
|
* $.return(cells.scan(($, acc, cell, i) => cell.equal("").ifElse(() => acc, () => cell), ""));
|
|
957
957
|
* });
|
|
958
|
-
* const compiled = East.compile(forwardFill
|
|
958
|
+
* const compiled = East.compile(forwardFill, []);
|
|
959
959
|
* compiled(["a", "", "", "b", ""]); // ["a", "a", "a", "b", "b"]
|
|
960
960
|
* ```
|
|
961
961
|
*
|
|
@@ -986,7 +986,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
986
986
|
* const allPositive = East.function([ArrayType(IntegerType)], BooleanType, ($, arr) => {
|
|
987
987
|
* $.return(arr.every(($, x, i) => x.greater(0n)));
|
|
988
988
|
* });
|
|
989
|
-
* const compiled = East.compile(allPositive
|
|
989
|
+
* const compiled = East.compile(allPositive, []);
|
|
990
990
|
* compiled([1n, 2n, 3n]); // true
|
|
991
991
|
* compiled([1n, -2n, 3n]); // false
|
|
992
992
|
* compiled([]); // true (empty array)
|
|
@@ -999,7 +999,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
999
999
|
* const allAdults = East.function([ArrayType(PersonType)], BooleanType, ($, people) => {
|
|
1000
1000
|
* $.return(people.every(($, p, i) => p.age.greaterOrEqual(18n)));
|
|
1001
1001
|
* });
|
|
1002
|
-
* const compiled = East.compile(allAdults
|
|
1002
|
+
* const compiled = East.compile(allAdults, []);
|
|
1003
1003
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]); // true
|
|
1004
1004
|
* ```
|
|
1005
1005
|
*
|
|
@@ -1020,7 +1020,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1020
1020
|
* const hasNegative = East.function([ArrayType(IntegerType)], BooleanType, ($, arr) => {
|
|
1021
1021
|
* $.return(arr.some(($, x, i) => x.less(0n)));
|
|
1022
1022
|
* });
|
|
1023
|
-
* const compiled = East.compile(hasNegative
|
|
1023
|
+
* const compiled = East.compile(hasNegative, []);
|
|
1024
1024
|
* compiled([1n, 2n, 3n]); // false
|
|
1025
1025
|
* compiled([1n, -2n, 3n]); // true
|
|
1026
1026
|
* compiled([]); // false (empty array)
|
|
@@ -1033,7 +1033,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1033
1033
|
* const hasMinor = East.function([ArrayType(PersonType)], BooleanType, ($, people) => {
|
|
1034
1034
|
* $.return(people.some(($, p, i) => p.age.less(18n)));
|
|
1035
1035
|
* });
|
|
1036
|
-
* const compiled = East.compile(hasMinor
|
|
1036
|
+
* const compiled = East.compile(hasMinor, []);
|
|
1037
1037
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 15n }]); // true
|
|
1038
1038
|
* ```
|
|
1039
1039
|
*
|
|
@@ -1051,7 +1051,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1051
1051
|
* const sumIntegers = East.function([ArrayType(IntegerType)], IntegerType, ($, arr) => {
|
|
1052
1052
|
* $.return(arr.sum());
|
|
1053
1053
|
* });
|
|
1054
|
-
* const compiled = East.compile(sumIntegers
|
|
1054
|
+
* const compiled = East.compile(sumIntegers, []);
|
|
1055
1055
|
* compiled([1n, 2n, 3n, 4n]); // 10n
|
|
1056
1056
|
* compiled([]); // 0n
|
|
1057
1057
|
* ```
|
|
@@ -1063,7 +1063,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1063
1063
|
* const totalAge = East.function([ArrayType(PersonType)], IntegerType, ($, people) => {
|
|
1064
1064
|
* $.return(people.sum(($, p, i) => p.age));
|
|
1065
1065
|
* });
|
|
1066
|
-
* const compiled = East.compile(totalAge
|
|
1066
|
+
* const compiled = East.compile(totalAge, []);
|
|
1067
1067
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]); // 55n
|
|
1068
1068
|
* ```
|
|
1069
1069
|
*/
|
|
@@ -1085,7 +1085,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1085
1085
|
* const avgNumbers = East.function([ArrayType(IntegerType)], FloatType, ($, arr) => {
|
|
1086
1086
|
* $.return(arr.mean());
|
|
1087
1087
|
* });
|
|
1088
|
-
* const compiled = East.compile(avgNumbers
|
|
1088
|
+
* const compiled = East.compile(avgNumbers, []);
|
|
1089
1089
|
* compiled([1n, 2n, 3n, 4n]); // 2.5
|
|
1090
1090
|
* compiled([]); // NaN
|
|
1091
1091
|
* ```
|
|
@@ -1097,7 +1097,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1097
1097
|
* const avgAge = East.function([ArrayType(PersonType)], FloatType, ($, people) => {
|
|
1098
1098
|
* $.return(people.mean(($, p, i) => p.age));
|
|
1099
1099
|
* });
|
|
1100
|
-
* const compiled = East.compile(avgAge
|
|
1100
|
+
* const compiled = East.compile(avgAge, []);
|
|
1101
1101
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 20n }]); // 25.0
|
|
1102
1102
|
* ```
|
|
1103
1103
|
*/
|
|
@@ -1116,7 +1116,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1116
1116
|
* const findMax = East.function([ArrayType(IntegerType)], OptionType(IntegerType), ($, arr) => {
|
|
1117
1117
|
* $.return(arr.findMaximum());
|
|
1118
1118
|
* });
|
|
1119
|
-
* const compiled = East.compile(findMax
|
|
1119
|
+
* const compiled = East.compile(findMax, []);
|
|
1120
1120
|
* compiled([3n, 1n, 4n, 1n, 5n]); // .some(4n) - index of 5
|
|
1121
1121
|
* compiled([]); // .none
|
|
1122
1122
|
* ```
|
|
@@ -1128,7 +1128,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1128
1128
|
* const findOldest = East.function([ArrayType(PersonType)], OptionType(IntegerType), ($, people) => {
|
|
1129
1129
|
* $.return(people.findMaximum(($, p, i) => p.age));
|
|
1130
1130
|
* });
|
|
1131
|
-
* const compiled = East.compile(findOldest
|
|
1131
|
+
* const compiled = East.compile(findOldest, []);
|
|
1132
1132
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]); // .some(0n)
|
|
1133
1133
|
* ```
|
|
1134
1134
|
*
|
|
@@ -1149,7 +1149,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1149
1149
|
* const findMin = East.function([ArrayType(IntegerType)], OptionType(IntegerType), ($, arr) => {
|
|
1150
1150
|
* $.return(arr.findMinimum());
|
|
1151
1151
|
* });
|
|
1152
|
-
* const compiled = East.compile(findMin
|
|
1152
|
+
* const compiled = East.compile(findMin, []);
|
|
1153
1153
|
* compiled([3n, 1n, 4n, 1n, 5n]); // .some(1n) - index of first 1
|
|
1154
1154
|
* compiled([]); // .none
|
|
1155
1155
|
* ```
|
|
@@ -1161,7 +1161,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1161
1161
|
* const findYoungest = East.function([ArrayType(PersonType)], OptionType(IntegerType), ($, people) => {
|
|
1162
1162
|
* $.return(people.findMinimum(($, p, i) => p.age));
|
|
1163
1163
|
* });
|
|
1164
|
-
* const compiled = East.compile(findYoungest
|
|
1164
|
+
* const compiled = East.compile(findYoungest, []);
|
|
1165
1165
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]); // .some(1n)
|
|
1166
1166
|
* ```
|
|
1167
1167
|
*
|
|
@@ -1184,7 +1184,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1184
1184
|
* const getMax = East.function([ArrayType(IntegerType)], IntegerType, ($, arr) => {
|
|
1185
1185
|
* $.return(arr.maximum());
|
|
1186
1186
|
* });
|
|
1187
|
-
* const compiled = East.compile(getMax
|
|
1187
|
+
* const compiled = East.compile(getMax, []);
|
|
1188
1188
|
* compiled([3n, 1n, 4n, 1n, 5n]); // 5n
|
|
1189
1189
|
* // compiled([]) would throw error
|
|
1190
1190
|
* ```
|
|
@@ -1196,7 +1196,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1196
1196
|
* const getOldest = East.function([ArrayType(PersonType)], PersonType, ($, people) => {
|
|
1197
1197
|
* $.return(people.maximum(($, p, i) => p.age));
|
|
1198
1198
|
* });
|
|
1199
|
-
* const compiled = East.compile(getOldest
|
|
1199
|
+
* const compiled = East.compile(getOldest, []);
|
|
1200
1200
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]);
|
|
1201
1201
|
* // { name: "Alice", age: 30n }
|
|
1202
1202
|
* ```
|
|
@@ -1220,7 +1220,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1220
1220
|
* const getMin = East.function([ArrayType(IntegerType)], IntegerType, ($, arr) => {
|
|
1221
1221
|
* $.return(arr.minimum());
|
|
1222
1222
|
* });
|
|
1223
|
-
* const compiled = East.compile(getMin
|
|
1223
|
+
* const compiled = East.compile(getMin, []);
|
|
1224
1224
|
* compiled([3n, 1n, 4n, 1n, 5n]); // 1n
|
|
1225
1225
|
* // compiled([]) would throw error
|
|
1226
1226
|
* ```
|
|
@@ -1232,7 +1232,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1232
1232
|
* const getYoungest = East.function([ArrayType(PersonType)], PersonType, ($, people) => {
|
|
1233
1233
|
* $.return(people.minimum(($, p, i) => p.age));
|
|
1234
1234
|
* });
|
|
1235
|
-
* const compiled = East.compile(getYoungest
|
|
1235
|
+
* const compiled = East.compile(getYoungest, []);
|
|
1236
1236
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]);
|
|
1237
1237
|
* // { name: "Bob", age: 25n }
|
|
1238
1238
|
* ```
|
|
@@ -1257,7 +1257,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1257
1257
|
* const joinStrings = East.function([ArrayType(StringType), StringType], StringType, ($, arr, delimiter) => {
|
|
1258
1258
|
* $.return(arr.stringJoin(delimiter));
|
|
1259
1259
|
* });
|
|
1260
|
-
* const compiled = East.compile(joinStrings
|
|
1260
|
+
* const compiled = East.compile(joinStrings, []);
|
|
1261
1261
|
* compiled(["a", "b", "c"], ", "); // "a, b, c"
|
|
1262
1262
|
* compiled(["hello", "world"], " "); // "hello world"
|
|
1263
1263
|
* compiled([], ", "); // ""
|
|
@@ -1278,7 +1278,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1278
1278
|
* const uniqueNumbers = East.function([ArrayType(IntegerType)], SetType(IntegerType), ($, arr) => {
|
|
1279
1279
|
* $.return(arr.toSet());
|
|
1280
1280
|
* });
|
|
1281
|
-
* const compiled = East.compile(uniqueNumbers
|
|
1281
|
+
* const compiled = East.compile(uniqueNumbers, []);
|
|
1282
1282
|
* compiled([1n, 2n, 3n, 2n, 1n]); // Set{1n, 2n, 3n}
|
|
1283
1283
|
* ```
|
|
1284
1284
|
*
|
|
@@ -1289,7 +1289,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1289
1289
|
* const uniqueAges = East.function([ArrayType(PersonType)], SetType(IntegerType), ($, people) => {
|
|
1290
1290
|
* $.return(people.toSet(($, p, i) => p.age));
|
|
1291
1291
|
* });
|
|
1292
|
-
* const compiled = East.compile(uniqueAges
|
|
1292
|
+
* const compiled = East.compile(uniqueAges, []);
|
|
1293
1293
|
* compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }, { name: "Carol", age: 30n }]);
|
|
1294
1294
|
* // Set{25n, 30n}
|
|
1295
1295
|
* ```
|
|
@@ -1312,7 +1312,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1312
1312
|
* const indexToValue = East.function([ArrayType(StringType)], DictType(IntegerType, StringType), ($, arr) => {
|
|
1313
1313
|
* $.return(arr.toDict());
|
|
1314
1314
|
* });
|
|
1315
|
-
* const compiled = East.compile(indexToValue
|
|
1315
|
+
* const compiled = East.compile(indexToValue, []);
|
|
1316
1316
|
* compiled(["a", "b", "c"]); // Dict{0n: "a", 1n: "b", 2n: "c"}
|
|
1317
1317
|
* ```
|
|
1318
1318
|
*
|
|
@@ -1323,7 +1323,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1323
1323
|
* const idToName = East.function([ArrayType(PersonType)], DictType(IntegerType, StringType), ($, people) => {
|
|
1324
1324
|
* $.return(people.toDict(($, p, i) => p.id, ($, p, i) => p.name));
|
|
1325
1325
|
* });
|
|
1326
|
-
* const compiled = East.compile(idToName
|
|
1326
|
+
* const compiled = East.compile(idToName, []);
|
|
1327
1327
|
* compiled([{ id: 1n, name: "Alice" }, { id: 2n, name: "Bob" }]);
|
|
1328
1328
|
* // Dict{1n: "Alice", 2n: "Bob"}
|
|
1329
1329
|
*
|
|
@@ -1358,7 +1358,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1358
1358
|
* const flattenArrays = East.function([ArrayType(ArrayType(IntegerType))], ArrayType(IntegerType), ($, arr) => {
|
|
1359
1359
|
* $.return(arr.flatMap());
|
|
1360
1360
|
* });
|
|
1361
|
-
* const compiled = East.compile(flattenArrays
|
|
1361
|
+
* const compiled = East.compile(flattenArrays, []);
|
|
1362
1362
|
* compiled([[1n, 2n], [3n, 4n], [5n]]); // [1n, 2n, 3n, 4n, 5n]
|
|
1363
1363
|
* ```
|
|
1364
1364
|
*
|
|
@@ -1369,7 +1369,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1369
1369
|
* const allFriends = East.function([ArrayType(PersonType)], ArrayType(StringType), ($, people) => {
|
|
1370
1370
|
* $.return(people.flatMap(($, p, i) => p.friends));
|
|
1371
1371
|
* });
|
|
1372
|
-
* const compiled = East.compile(allFriends
|
|
1372
|
+
* const compiled = East.compile(allFriends, []);
|
|
1373
1373
|
* compiled([
|
|
1374
1374
|
* { name: "Alice", friends: ["Bob", "Carol"] },
|
|
1375
1375
|
* { name: "Bob", friends: ["Alice"] }
|
|
@@ -1396,7 +1396,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1396
1396
|
* const flattenSets = East.function([ArrayType(SetType(IntegerType))], SetType(IntegerType), ($, arr) => {
|
|
1397
1397
|
* $.return(arr.flattenToSet());
|
|
1398
1398
|
* });
|
|
1399
|
-
* const compiled = East.compile(flattenSets
|
|
1399
|
+
* const compiled = East.compile(flattenSets, []);
|
|
1400
1400
|
* compiled([Set{1n, 2n}, Set{2n, 3n}, Set{3n, 4n}]); // Set{1n, 2n, 3n, 4n}
|
|
1401
1401
|
* ```
|
|
1402
1402
|
*
|
|
@@ -1423,7 +1423,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1423
1423
|
* const flattenDicts = East.function([ArrayType(DictType(StringType, IntegerType))], DictType(StringType, IntegerType), ($, arr) => {
|
|
1424
1424
|
* $.return(arr.flattenToDict());
|
|
1425
1425
|
* });
|
|
1426
|
-
* const compiled = East.compile(flattenDicts
|
|
1426
|
+
* const compiled = East.compile(flattenDicts, []);
|
|
1427
1427
|
* compiled([Dict{"a": 1n, "b": 2n}, Dict{"c": 3n}]); // Dict{"a": 1n, "b": 2n, "c": 3n}
|
|
1428
1428
|
* ```
|
|
1429
1429
|
*
|
|
@@ -1433,6 +1433,83 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1433
1433
|
flattenToDict<K2, V2>(fn: Expr<FunctionType<[T, IntegerType], DictType<K2, V2>>>, onConflict?: SubtypeExprOrValue<FunctionType<[NoInfer<V2>, NoInfer<V2>, NoInfer<K2>], NoInfer<V2>>>): DictExpr<K2, V2>;
|
|
1434
1434
|
flattenToDict<F extends (($: BlockBuilder<NeverType>, v: ExprType<T>, k: ExprType<IntegerType>) => any)>(fn: F, onConflict?: SubtypeExprOrValue<FunctionType<[TypeOf<ReturnType<NoInfer<F>>> extends DictType<any, infer V2> ? V2 : never, TypeOf<ReturnType<NoInfer<F>>> extends DictType<any, infer V2> ? V2 : never, TypeOf<ReturnType<NoInfer<F>>> extends DictType<infer K2, any> ? K2 : never], TypeOf<ReturnType<NoInfer<F>>> extends DictType<any, infer V2> ? V2 : never>>): TypeOf<ReturnType<F>> extends DictType<infer K2, infer V2> ? DictExpr<K2, V2> : never;
|
|
1435
1435
|
flattenToDict(): T extends DictType<infer K2, infer V2> ? DictExpr<K2, V2> : never;
|
|
1436
|
+
/**
|
|
1437
|
+
* Builds a tree of any depth from flat, parent-keyed elements, in a node type of your own.
|
|
1438
|
+
*
|
|
1439
|
+
* Each element names its own key (`keyFn`) and its parent's key (`parentFn`); `buildFn` turns
|
|
1440
|
+
* an element and its children's built nodes into its node. The result is the roots.
|
|
1441
|
+
*
|
|
1442
|
+
* @param node - The node type `buildFn` returns; its `children` argument is an Array of it
|
|
1443
|
+
* @param keyFn - Function taking (element, index) and returning the element's key
|
|
1444
|
+
* @param parentFn - Function taking (element, index) and returning its parent's key, or `none` for a root
|
|
1445
|
+
* @param buildFn - Function taking (element, index, children) and returning the element's node
|
|
1446
|
+
* @returns An ArrayExpr of the root nodes, in array order
|
|
1447
|
+
*
|
|
1448
|
+
* @throws East runtime error if two elements have the same key, naming the key at the element that repeats it
|
|
1449
|
+
* @throws East runtime error if the parents form a cycle, naming the first key in array order on the cycle
|
|
1450
|
+
*
|
|
1451
|
+
* @remarks
|
|
1452
|
+
* - An element whose parent key is not in the array (an orphan) becomes a root.
|
|
1453
|
+
* - `buildFn` runs once per element, children before parents; `children` holds the built children in array
|
|
1454
|
+
* order. Every `keyFn` runs first, then every `parentFn`, and the cycle check comes before any `buildFn`.
|
|
1455
|
+
* - `node` can be any type. A recursive node type builds a tree value; a non-recursive one makes `toTree` a
|
|
1456
|
+
* bottom-up fold, e.g. `IntegerType` with `children.sum().add(1n)` gives each root's subtree size.
|
|
1457
|
+
* - The walk is iterative, so building costs no stack at any depth. A recursive node value is still limited
|
|
1458
|
+
* in depth on the C and Python runtimes, which collect and free a value recursively: tens of thousands of
|
|
1459
|
+
* levels.
|
|
1460
|
+
*
|
|
1461
|
+
* @example
|
|
1462
|
+
* ```ts
|
|
1463
|
+
* const RowType = StructType({ id: StringType, parent: OptionType(StringType), name: StringType });
|
|
1464
|
+
* const NodeType = RecursiveType(self => StructType({ name: StringType, children: ArrayType(self) }));
|
|
1465
|
+
*
|
|
1466
|
+
* const nest = East.function([ArrayType(RowType)], ArrayType(NodeType), ($, rows) => {
|
|
1467
|
+
* $.return(rows.toTree(
|
|
1468
|
+
* NodeType,
|
|
1469
|
+
* ($, row, i) => row.id,
|
|
1470
|
+
* ($, row, i) => row.parent,
|
|
1471
|
+
* ($, row, i, children) => ({ name: row.name, children }),
|
|
1472
|
+
* ));
|
|
1473
|
+
* });
|
|
1474
|
+
* const compiled = East.compile(nest, []);
|
|
1475
|
+
* compiled([
|
|
1476
|
+
* { id: "animals", parent: none, name: "Animals" },
|
|
1477
|
+
* { id: "birds", parent: some("animals"), name: "Birds" },
|
|
1478
|
+
* { id: "mammals", parent: some("animals"), name: "Mammals" },
|
|
1479
|
+
* { id: "whales", parent: some("mammals"), name: "Whales" },
|
|
1480
|
+
* ]);
|
|
1481
|
+
* // [{ name: "Animals", children: [
|
|
1482
|
+
* // { name: "Birds", children: [] },
|
|
1483
|
+
* // { name: "Mammals", children: [{ name: "Whales", children: [] }] },
|
|
1484
|
+
* // ] }]
|
|
1485
|
+
* ```
|
|
1486
|
+
*
|
|
1487
|
+
* @example
|
|
1488
|
+
* ```ts
|
|
1489
|
+
* // A non-recursive node type folds bottom-up: the size of each root's subtree
|
|
1490
|
+
* const RowType = StructType({ id: IntegerType, parent: OptionType(IntegerType) });
|
|
1491
|
+
*
|
|
1492
|
+
* const sizes = East.function([ArrayType(RowType)], ArrayType(IntegerType), ($, rows) => {
|
|
1493
|
+
* $.return(rows.toTree(
|
|
1494
|
+
* IntegerType,
|
|
1495
|
+
* ($, row, i) => row.id,
|
|
1496
|
+
* ($, row, i) => row.parent,
|
|
1497
|
+
* ($, row, i, children) => children.sum().add(1n),
|
|
1498
|
+
* ));
|
|
1499
|
+
* });
|
|
1500
|
+
* const compiled = East.compile(sizes, []);
|
|
1501
|
+
* compiled([
|
|
1502
|
+
* { id: 1n, parent: none },
|
|
1503
|
+
* { id: 2n, parent: some(1n) },
|
|
1504
|
+
* { id: 3n, parent: some(2n) },
|
|
1505
|
+
* { id: 4n, parent: none },
|
|
1506
|
+
* ]); // [3n, 1n]
|
|
1507
|
+
* ```
|
|
1508
|
+
*
|
|
1509
|
+
* @see {@link toDict} to index elements by key without nesting them.
|
|
1510
|
+
*/
|
|
1511
|
+
toTree<N extends EastType, K>(node: N, keyFn: Expr<FunctionType<[T, IntegerType], K>>, parentFn: SubtypeExprOrValue<FunctionType<[T, IntegerType], OptionType<NoInfer<K>>>>, buildFn: SubtypeExprOrValue<FunctionType<[T, IntegerType, ArrayType<NoInfer<N>>], NoInfer<N>>>): ArrayExpr<N>;
|
|
1512
|
+
toTree<N extends EastType, KeyFn extends (($: BlockBuilder<NeverType>, x: ExprType<T>, i: IntegerExpr) => any)>(node: N, keyFn: KeyFn, parentFn: SubtypeExprOrValue<FunctionType<[T, IntegerType], OptionType<TypeOf<ReturnType<NoInfer<KeyFn>>>>>>, buildFn: SubtypeExprOrValue<FunctionType<[T, IntegerType, ArrayType<NoInfer<N>>], NoInfer<N>>>): ArrayExpr<N>;
|
|
1436
1513
|
/**
|
|
1437
1514
|
* Group array elements by a key function, initialize each group, and reduce within each group.
|
|
1438
1515
|
*
|
|
@@ -1808,7 +1885,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1808
1885
|
* const toCsv = East.function([ArrayType(PersonType)], BlobType, ($, people) => {
|
|
1809
1886
|
* $.return(people.encodeCsv({ delimiter: ',' }));
|
|
1810
1887
|
* });
|
|
1811
|
-
* const compiled = East.compile(toCsv
|
|
1888
|
+
* const compiled = East.compile(toCsv, []);
|
|
1812
1889
|
* const blob = compiled([{ name: "Alice", age: 30n }, { name: "Bob", age: 25n }]);
|
|
1813
1890
|
* new TextDecoder().decode(blob); // "name,age\r\nAlice,30\r\nBob,25"
|
|
1814
1891
|
* ```
|
|
@@ -1825,7 +1902,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1825
1902
|
* const isEqual = East.function([ArrayType(IntegerType), ArrayType(IntegerType)], BooleanType, ($, a, b) => {
|
|
1826
1903
|
* $.return(a.equals(b));
|
|
1827
1904
|
* });
|
|
1828
|
-
* const compiled = East.compile(isEqual
|
|
1905
|
+
* const compiled = East.compile(isEqual, []);
|
|
1829
1906
|
* compiled([1n, 2n, 3n], [1n, 2n, 3n]); // true
|
|
1830
1907
|
* compiled([1n, 2n], [1n, 2n, 3n]); // false
|
|
1831
1908
|
* ```
|
|
@@ -1842,7 +1919,7 @@ export declare class ArrayExpr<T extends any> extends Expr<ArrayType<T>> {
|
|
|
1842
1919
|
* const isNotEqual = East.function([ArrayType(IntegerType), ArrayType(IntegerType)], BooleanType, ($, a, b) => {
|
|
1843
1920
|
* $.return(a.notEquals(b));
|
|
1844
1921
|
* });
|
|
1845
|
-
* const compiled = East.compile(isNotEqual
|
|
1922
|
+
* const compiled = East.compile(isNotEqual, []);
|
|
1846
1923
|
* compiled([1n, 2n], [1n, 2n, 3n]); // true
|
|
1847
1924
|
* compiled([1n, 2n, 3n], [1n, 2n, 3n]); // false
|
|
1848
1925
|
* ```
|