@elaraai/east 0.0.1-beta.0
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/LICENSE.md +682 -0
- package/README.md +276 -0
- package/dist/src/analyze.d.ts +95 -0
- package/dist/src/analyze.d.ts.map +1 -0
- package/dist/src/analyze.js +1110 -0
- package/dist/src/analyze.js.map +1 -0
- package/dist/src/ast.d.ts +263 -0
- package/dist/src/ast.d.ts.map +1 -0
- package/dist/src/ast.js +151 -0
- package/dist/src/ast.js.map +1 -0
- package/dist/src/ast_to_ir.d.ts +24 -0
- package/dist/src/ast_to_ir.d.ts.map +1 -0
- package/dist/src/ast_to_ir.js +834 -0
- package/dist/src/ast_to_ir.js.map +1 -0
- package/dist/src/builtins.d.ts +18 -0
- package/dist/src/builtins.d.ts.map +1 -0
- package/dist/src/builtins.js +1105 -0
- package/dist/src/builtins.js.map +1 -0
- package/dist/src/comparison.d.ts +28 -0
- package/dist/src/comparison.d.ts.map +1 -0
- package/dist/src/comparison.js +1017 -0
- package/dist/src/comparison.js.map +1 -0
- package/dist/src/compile.d.ts +22 -0
- package/dist/src/compile.d.ts.map +1 -0
- package/dist/src/compile.js +3260 -0
- package/dist/src/compile.js.map +1 -0
- package/dist/src/containers/ref.d.ts +106 -0
- package/dist/src/containers/ref.d.ts.map +1 -0
- package/dist/src/containers/ref.js +100 -0
- package/dist/src/containers/ref.js.map +1 -0
- package/dist/src/containers/sortedmap.d.ts +165 -0
- package/dist/src/containers/sortedmap.d.ts.map +1 -0
- package/dist/src/containers/sortedmap.js +237 -0
- package/dist/src/containers/sortedmap.js.map +1 -0
- package/dist/src/containers/sortedset.d.ts +185 -0
- package/dist/src/containers/sortedset.d.ts.map +1 -0
- package/dist/src/containers/sortedset.js +312 -0
- package/dist/src/containers/sortedset.js.map +1 -0
- package/dist/src/containers/variant.d.ts +131 -0
- package/dist/src/containers/variant.d.ts.map +1 -0
- package/dist/src/containers/variant.js +68 -0
- package/dist/src/containers/variant.js.map +1 -0
- package/dist/src/datetime_format/parse.d.ts +50 -0
- package/dist/src/datetime_format/parse.d.ts.map +1 -0
- package/dist/src/datetime_format/parse.js +908 -0
- package/dist/src/datetime_format/parse.js.map +1 -0
- package/dist/src/datetime_format/print.d.ts +35 -0
- package/dist/src/datetime_format/print.d.ts.map +1 -0
- package/dist/src/datetime_format/print.js +157 -0
- package/dist/src/datetime_format/print.js.map +1 -0
- package/dist/src/datetime_format/tokenize.d.ts +76 -0
- package/dist/src/datetime_format/tokenize.d.ts.map +1 -0
- package/dist/src/datetime_format/tokenize.js +271 -0
- package/dist/src/datetime_format/tokenize.js.map +1 -0
- package/dist/src/datetime_format/types.d.ts +99 -0
- package/dist/src/datetime_format/types.d.ts.map +1 -0
- package/dist/src/datetime_format/types.js +103 -0
- package/dist/src/datetime_format/types.js.map +1 -0
- package/dist/src/datetime_format/validate.d.ts +51 -0
- package/dist/src/datetime_format/validate.d.ts.map +1 -0
- package/dist/src/datetime_format/validate.js +208 -0
- package/dist/src/datetime_format/validate.js.map +1 -0
- package/dist/src/default.d.ts +21 -0
- package/dist/src/default.d.ts.map +1 -0
- package/dist/src/default.js +82 -0
- package/dist/src/default.js.map +1 -0
- package/dist/src/eastir.d.ts +33 -0
- package/dist/src/eastir.d.ts.map +1 -0
- package/dist/src/eastir.js +92 -0
- package/dist/src/eastir.js.map +1 -0
- package/dist/src/error.d.ts +13 -0
- package/dist/src/error.d.ts.map +1 -0
- package/dist/src/error.js +8 -0
- package/dist/src/error.js.map +1 -0
- package/dist/src/expr/array.d.ts +1711 -0
- package/dist/src/expr/array.d.ts.map +1 -0
- package/dist/src/expr/array.js +1805 -0
- package/dist/src/expr/array.js.map +1 -0
- package/dist/src/expr/ast.d.ts +17 -0
- package/dist/src/expr/ast.d.ts.map +1 -0
- package/dist/src/expr/ast.js +302 -0
- package/dist/src/expr/ast.js.map +1 -0
- package/dist/src/expr/blob.d.ts +141 -0
- package/dist/src/expr/blob.d.ts.map +1 -0
- package/dist/src/expr/blob.js +198 -0
- package/dist/src/expr/blob.js.map +1 -0
- package/dist/src/expr/block.d.ts +201 -0
- package/dist/src/expr/block.d.ts.map +1 -0
- package/dist/src/expr/block.js +1505 -0
- package/dist/src/expr/block.js.map +1 -0
- package/dist/src/expr/boolean.d.ts +207 -0
- package/dist/src/expr/boolean.d.ts.map +1 -0
- package/dist/src/expr/boolean.js +261 -0
- package/dist/src/expr/boolean.js.map +1 -0
- package/dist/src/expr/datetime.d.ts +544 -0
- package/dist/src/expr/datetime.d.ts.map +1 -0
- package/dist/src/expr/datetime.js +980 -0
- package/dist/src/expr/datetime.js.map +1 -0
- package/dist/src/expr/dict.d.ts +1242 -0
- package/dist/src/expr/dict.d.ts.map +1 -0
- package/dist/src/expr/dict.js +1492 -0
- package/dist/src/expr/dict.js.map +1 -0
- package/dist/src/expr/expr.d.ts +95 -0
- package/dist/src/expr/expr.d.ts.map +1 -0
- package/dist/src/expr/expr.js +171 -0
- package/dist/src/expr/expr.js.map +1 -0
- package/dist/src/expr/float.d.ts +357 -0
- package/dist/src/expr/float.d.ts.map +1 -0
- package/dist/src/expr/float.js +637 -0
- package/dist/src/expr/float.js.map +1 -0
- package/dist/src/expr/function.d.ts +46 -0
- package/dist/src/expr/function.d.ts.map +1 -0
- package/dist/src/expr/function.js +58 -0
- package/dist/src/expr/function.js.map +1 -0
- package/dist/src/expr/index.d.ts +450 -0
- package/dist/src/expr/index.d.ts.map +1 -0
- package/dist/src/expr/index.js +423 -0
- package/dist/src/expr/index.js.map +1 -0
- package/dist/src/expr/integer.d.ts +256 -0
- package/dist/src/expr/integer.d.ts.map +1 -0
- package/dist/src/expr/integer.js +311 -0
- package/dist/src/expr/integer.js.map +1 -0
- package/dist/src/expr/libs/array.d.ts +106 -0
- package/dist/src/expr/libs/array.d.ts.map +1 -0
- package/dist/src/expr/libs/array.js +140 -0
- package/dist/src/expr/libs/array.js.map +1 -0
- package/dist/src/expr/libs/blob.d.ts +42 -0
- package/dist/src/expr/libs/blob.d.ts.map +1 -0
- package/dist/src/expr/libs/blob.js +70 -0
- package/dist/src/expr/libs/blob.js.map +1 -0
- package/dist/src/expr/libs/datetime.d.ts +479 -0
- package/dist/src/expr/libs/datetime.d.ts.map +1 -0
- package/dist/src/expr/libs/datetime.js +624 -0
- package/dist/src/expr/libs/datetime.js.map +1 -0
- package/dist/src/expr/libs/dict.d.ts +66 -0
- package/dist/src/expr/libs/dict.d.ts.map +1 -0
- package/dist/src/expr/libs/dict.js +77 -0
- package/dist/src/expr/libs/dict.js.map +1 -0
- package/dist/src/expr/libs/float.d.ts +299 -0
- package/dist/src/expr/libs/float.d.ts.map +1 -0
- package/dist/src/expr/libs/float.js +564 -0
- package/dist/src/expr/libs/float.js.map +1 -0
- package/dist/src/expr/libs/integer.d.ts +228 -0
- package/dist/src/expr/libs/integer.d.ts.map +1 -0
- package/dist/src/expr/libs/integer.js +398 -0
- package/dist/src/expr/libs/integer.js.map +1 -0
- package/dist/src/expr/libs/set.d.ts +59 -0
- package/dist/src/expr/libs/set.d.ts.map +1 -0
- package/dist/src/expr/libs/set.js +69 -0
- package/dist/src/expr/libs/set.js.map +1 -0
- package/dist/src/expr/libs/string.d.ts +71 -0
- package/dist/src/expr/libs/string.d.ts.map +1 -0
- package/dist/src/expr/libs/string.js +75 -0
- package/dist/src/expr/libs/string.js.map +1 -0
- package/dist/src/expr/never.d.ts +15 -0
- package/dist/src/expr/never.d.ts.map +1 -0
- package/dist/src/expr/never.js +12 -0
- package/dist/src/expr/never.js.map +1 -0
- package/dist/src/expr/null.d.ts +15 -0
- package/dist/src/expr/null.d.ts.map +1 -0
- package/dist/src/expr/null.js +12 -0
- package/dist/src/expr/null.js.map +1 -0
- package/dist/src/expr/ref.d.ts +103 -0
- package/dist/src/expr/ref.d.ts.map +1 -0
- package/dist/src/expr/ref.js +131 -0
- package/dist/src/expr/ref.js.map +1 -0
- package/dist/src/expr/regex_validation.d.ts +25 -0
- package/dist/src/expr/regex_validation.d.ts.map +1 -0
- package/dist/src/expr/regex_validation.js +130 -0
- package/dist/src/expr/regex_validation.js.map +1 -0
- package/dist/src/expr/set.d.ts +1071 -0
- package/dist/src/expr/set.d.ts.map +1 -0
- package/dist/src/expr/set.js +1137 -0
- package/dist/src/expr/set.js.map +1 -0
- package/dist/src/expr/string.d.ts +414 -0
- package/dist/src/expr/string.d.ts.map +1 -0
- package/dist/src/expr/string.js +683 -0
- package/dist/src/expr/string.js.map +1 -0
- package/dist/src/expr/struct.d.ts +48 -0
- package/dist/src/expr/struct.d.ts.map +1 -0
- package/dist/src/expr/struct.js +65 -0
- package/dist/src/expr/struct.js.map +1 -0
- package/dist/src/expr/types.d.ts +68 -0
- package/dist/src/expr/types.d.ts.map +1 -0
- package/dist/src/expr/types.js +6 -0
- package/dist/src/expr/types.js.map +1 -0
- package/dist/src/expr/variant.d.ts +137 -0
- package/dist/src/expr/variant.d.ts.map +1 -0
- package/dist/src/expr/variant.js +105 -0
- package/dist/src/expr/variant.js.map +1 -0
- package/dist/src/fuzz.d.ts +80 -0
- package/dist/src/fuzz.d.ts.map +1 -0
- package/dist/src/fuzz.js +300 -0
- package/dist/src/fuzz.js.map +1 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +21 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internal.d.ts +36 -0
- package/dist/src/internal.d.ts.map +1 -0
- package/dist/src/internal.js +11 -0
- package/dist/src/internal.js.map +1 -0
- package/dist/src/ir.d.ts +1571 -0
- package/dist/src/ir.d.ts.map +1 -0
- package/dist/src/ir.js +56 -0
- package/dist/src/ir.js.map +1 -0
- package/dist/src/location.d.ts +48 -0
- package/dist/src/location.d.ts.map +1 -0
- package/dist/src/location.js +62 -0
- package/dist/src/location.js.map +1 -0
- package/dist/src/platform.d.ts +21 -0
- package/dist/src/platform.d.ts.map +1 -0
- package/dist/src/platform.js +8 -0
- package/dist/src/platform.js.map +1 -0
- package/dist/src/serialization/beast.d.ts +39 -0
- package/dist/src/serialization/beast.d.ts.map +1 -0
- package/dist/src/serialization/beast.js +555 -0
- package/dist/src/serialization/beast.js.map +1 -0
- package/dist/src/serialization/beast2-stream.d.ts +38 -0
- package/dist/src/serialization/beast2-stream.d.ts.map +1 -0
- package/dist/src/serialization/beast2-stream.js +665 -0
- package/dist/src/serialization/beast2-stream.js.map +1 -0
- package/dist/src/serialization/beast2.d.ts +41 -0
- package/dist/src/serialization/beast2.d.ts.map +1 -0
- package/dist/src/serialization/beast2.js +489 -0
- package/dist/src/serialization/beast2.js.map +1 -0
- package/dist/src/serialization/binary-utils.d.ts +151 -0
- package/dist/src/serialization/binary-utils.d.ts.map +1 -0
- package/dist/src/serialization/binary-utils.js +929 -0
- package/dist/src/serialization/binary-utils.js.map +1 -0
- package/dist/src/serialization/east.d.ts +84 -0
- package/dist/src/serialization/east.d.ts.map +1 -0
- package/dist/src/serialization/east.js +1802 -0
- package/dist/src/serialization/east.js.map +1 -0
- package/dist/src/serialization/index.d.ts +11 -0
- package/dist/src/serialization/index.d.ts.map +1 -0
- package/dist/src/serialization/index.js +12 -0
- package/dist/src/serialization/index.js.map +1 -0
- package/dist/src/serialization/json.d.ts +36 -0
- package/dist/src/serialization/json.d.ts.map +1 -0
- package/dist/src/serialization/json.js +849 -0
- package/dist/src/serialization/json.js.map +1 -0
- package/dist/src/type_of_type.d.ts +115 -0
- package/dist/src/type_of_type.d.ts.map +1 -0
- package/dist/src/type_of_type.js +362 -0
- package/dist/src/type_of_type.js.map +1 -0
- package/dist/src/types.d.ts +648 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +1631 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/expr/function.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,E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,UAAU,EAAE,MAAM,GACjB,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAO5B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ast_to_ir } from "../ast_to_ir.js";
|
|
2
|
+
import { EastIR } from "../eastir.js";
|
|
3
|
+
import { get_location } from "../location.js";
|
|
4
|
+
import { FunctionType } from "../types.js";
|
|
5
|
+
import { valueOrExprToAstTyped } from "./ast.js";
|
|
6
|
+
import { AstSymbol, Expr, FactorySymbol } from "./expr.js";
|
|
7
|
+
/**
|
|
8
|
+
* Expression representing the Function type.
|
|
9
|
+
* Used for function calls, composition, etc.
|
|
10
|
+
*/
|
|
11
|
+
export class FunctionExpr extends Expr {
|
|
12
|
+
input_types;
|
|
13
|
+
output_type;
|
|
14
|
+
constructor(input_types, output_type, ast, createExpr) {
|
|
15
|
+
super(ast.type, ast, createExpr);
|
|
16
|
+
this.input_types = input_types;
|
|
17
|
+
this.output_type = output_type;
|
|
18
|
+
}
|
|
19
|
+
/** Note that {@link CallableFunctionExpr} provides a more ergonomic way to call functions.
|
|
20
|
+
*
|
|
21
|
+
* @internal */
|
|
22
|
+
call(...args) {
|
|
23
|
+
if (args.length !== this.input_types.length) {
|
|
24
|
+
throw new Error(`Expected ${this.input_types.length} arguments, got ${args.length}`);
|
|
25
|
+
}
|
|
26
|
+
const inputs = this.input_types.map((input_type, i) => valueOrExprToAstTyped(args[i], input_type));
|
|
27
|
+
return this[FactorySymbol]({
|
|
28
|
+
ast_type: "Call",
|
|
29
|
+
type: this.output_type,
|
|
30
|
+
location: get_location(2),
|
|
31
|
+
function: this[AstSymbol],
|
|
32
|
+
arguments: inputs,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** Convert the function to East's "intermediate representation" (IR). This can then be serialized or compiled.
|
|
36
|
+
*
|
|
37
|
+
* Note that the function must be a "free" function, with no captures.
|
|
38
|
+
*/
|
|
39
|
+
toIR() {
|
|
40
|
+
const ir = ast_to_ir(this[AstSymbol]);
|
|
41
|
+
return new EastIR(ir);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Factory producing a callable FunctionExpr so users can invoke it directly.
|
|
46
|
+
* Prototype chain preserved for instanceof checks.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export function createFunctionExpr(input_types, output_type, ast, createExpr) {
|
|
51
|
+
const inst = new FunctionExpr(input_types, output_type, ast, createExpr);
|
|
52
|
+
const callable = function (...args) {
|
|
53
|
+
return inst.call(...args);
|
|
54
|
+
};
|
|
55
|
+
Object.setPrototypeOf(callable, inst);
|
|
56
|
+
return callable;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/expr/function.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAiB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAe,MAAM,WAAW,CAAC;AAGxE;;;EAGE;AACF,MAAM,OAAO,YAA6C,SAAQ,IAAwB;IACpE;IAAwB;IAA5C,YAAoB,WAAc,EAAU,WAAc,EAAE,GAAQ,EAAE,UAAkB;QACtF,KAAK,CAAC,GAAG,CAAC,IAA0B,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QADrC,gBAAW,GAAX,WAAW,CAAG;QAAU,gBAAW,GAAX,WAAW,CAAG;IAE1D,CAAC;IAED;;mBAEe;IACf,IAAI,CAAC,GAAG,IAAkD;QACxD,IAAI,IAAI,CAAC,MA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 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
import { Expr } from './expr.js';
|
|
7
|
+
export { Expr } from './expr.js';
|
|
8
|
+
import { from, equal, notEqual, less, lessEqual, print, is, greaterEqual, greater, func, str, platform } from './block.js';
|
|
9
|
+
export { BlockBuilder } from './block.js';
|
|
10
|
+
export type { ToExpr as ExprFactory } from './expr.js';
|
|
11
|
+
/**
|
|
12
|
+
* Standard entry point for constructing East expressions.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* // Create expressions from values
|
|
17
|
+
* East.value(3.14).add(2)
|
|
18
|
+
*
|
|
19
|
+
* // String interpolation
|
|
20
|
+
* East.str`Hello, ${name}!`
|
|
21
|
+
*
|
|
22
|
+
* // Comparisons
|
|
23
|
+
* East.equal(x, y)
|
|
24
|
+
* East.less(x, y)
|
|
25
|
+
*
|
|
26
|
+
* // Create functions
|
|
27
|
+
* East.function([IntegerType], IntegerType, ($, x) => $.return(x.add(1n)))
|
|
28
|
+
*
|
|
29
|
+
* // Standard library
|
|
30
|
+
* East.Integer.printCommaSeperated(1234567890n)
|
|
31
|
+
* East.Array.range(0n, 10n)
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const East: {
|
|
35
|
+
/**
|
|
36
|
+
* Creates an East expression from a JavaScript value.
|
|
37
|
+
* Type is inferred from the value, or can be explicitly specified.
|
|
38
|
+
*
|
|
39
|
+
* @param value - The JavaScript value to convert to an East expression
|
|
40
|
+
* @param type - Optional explicit type specification
|
|
41
|
+
* @returns An East expression wrapping the value
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* East.value(42n) // IntegerExpr
|
|
46
|
+
* East.value(3.14) // FloatExpr
|
|
47
|
+
* East.value("hello") // StringExpr
|
|
48
|
+
* East.value([1n, 2n, 3n]) // ArrayExpr<IntegerType>
|
|
49
|
+
* East.value(new Map([[1n, "a"]])) // DictExpr<IntegerType, StringType>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
value: typeof from;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a string expression with interpolation support.
|
|
55
|
+
* Allows embedding East expressions inside template literals.
|
|
56
|
+
*
|
|
57
|
+
* @returns A StringExpr with the interpolated values
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* East.str`Hello, ${name}!`
|
|
62
|
+
* East.str`Total: ${count} items`
|
|
63
|
+
* East.str`Result: ${x.add(y)}`
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
str: typeof str;
|
|
67
|
+
/**
|
|
68
|
+
* Creates an East function with typed inputs and output.
|
|
69
|
+
* Functions can be nested, serialized to IR, and compiled to JavaScript.
|
|
70
|
+
*
|
|
71
|
+
* @param inputs - Array of East types for function parameters
|
|
72
|
+
* @param output - East type for function return value
|
|
73
|
+
* @param body - Function body using block builder and parameters
|
|
74
|
+
* @returns A FunctionExpr that can be compiled or serialized
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const add = East.function(
|
|
79
|
+
* [IntegerType, IntegerType],
|
|
80
|
+
* IntegerType,
|
|
81
|
+
* ($, a, b) => $.return(a.add(b))
|
|
82
|
+
* );
|
|
83
|
+
*
|
|
84
|
+
* const fibonacci = East.function([IntegerType], IntegerType, ($, n) => {
|
|
85
|
+
* $.if(East.lessEqual(n, 1n), $ => $.return(n));
|
|
86
|
+
* $.return(fibonacci(n.subtract(1n)).add(fibonacci(n.subtract(2n))));
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
function: typeof func;
|
|
91
|
+
/**
|
|
92
|
+
* Defines a platform function that can be called from East code.
|
|
93
|
+
* Platform functions allow East code to interact with the external environment.
|
|
94
|
+
*
|
|
95
|
+
* @param name - The name of the platform function
|
|
96
|
+
* @param inputs - Array of East types for the function parameters
|
|
97
|
+
* @param output - East type for the function return value
|
|
98
|
+
* @returns A callable platform function helper
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const log = East.platform("log", [StringType], NullType);
|
|
103
|
+
* const readFile = East.platform("readFile", [StringType], StringType);
|
|
104
|
+
*
|
|
105
|
+
* const myFunction = East.function([StringType], NullType, ($, msg) => {
|
|
106
|
+
* $(log(East.str`Message: ${msg}`));
|
|
107
|
+
* $.return(null);
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* const platform = [
|
|
111
|
+
* log.implement(console.log),
|
|
112
|
+
* readFile.implement(fs.readFileSync),
|
|
113
|
+
* ];
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
platform: typeof platform;
|
|
117
|
+
/**
|
|
118
|
+
* Converts any East expression to its string representation.
|
|
119
|
+
* Uses the East serialization format (not JSON).
|
|
120
|
+
*
|
|
121
|
+
* @param expr - The expression to convert to a string
|
|
122
|
+
* @returns A StringExpr containing the string representation
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* East.print(42n) // "42"
|
|
127
|
+
* East.print(3.14) // "3.14"
|
|
128
|
+
* East.print([1n, 2n, 3n]) // "[1, 2, 3]"
|
|
129
|
+
* East.print({a: 1n, b: true}) // "(a=1, b=true)"
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
print: typeof print;
|
|
133
|
+
/**
|
|
134
|
+
* Deep equality comparison between two expressions.
|
|
135
|
+
* Compares values recursively, including nested structures.
|
|
136
|
+
*
|
|
137
|
+
* @param a - First expression to compare
|
|
138
|
+
* @param b - Second expression to compare
|
|
139
|
+
* @returns BooleanExpr that is true if values are deeply equal
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* East.equal(42n, 42n) // true
|
|
144
|
+
* East.equal([1n, 2n], [1n, 2n]) // true
|
|
145
|
+
* East.equal({a: 1n}, {a: 1n}) // true
|
|
146
|
+
* East.equal(x, y) // compare two expressions
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
equal: typeof equal;
|
|
150
|
+
/**
|
|
151
|
+
* Deep inequality comparison between two expressions.
|
|
152
|
+
* Returns true if values are not deeply equal.
|
|
153
|
+
*
|
|
154
|
+
* @param a - First expression to compare
|
|
155
|
+
* @param b - Second expression to compare
|
|
156
|
+
* @returns BooleanExpr that is true if values are not equal
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* East.notEqual(42n, 43n) // true
|
|
161
|
+
* East.notEqual([1n, 2n], [1n, 3n]) // true
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
notEqual: typeof notEqual;
|
|
165
|
+
/**
|
|
166
|
+
* Less-than comparison using East's total ordering.
|
|
167
|
+
* All East types have a defined total ordering, even complex structures.
|
|
168
|
+
*
|
|
169
|
+
* @param a - First expression to compare
|
|
170
|
+
* @param b - Second expression to compare
|
|
171
|
+
* @returns BooleanExpr that is true if a < b
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* East.less(1n, 2n) // true
|
|
176
|
+
* East.less(3.14, 2.0) // false
|
|
177
|
+
* East.less("apple", "banana") // true
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
less: typeof less;
|
|
181
|
+
/**
|
|
182
|
+
* Less-than-or-equal comparison using East's total ordering.
|
|
183
|
+
*
|
|
184
|
+
* @param a - First expression to compare
|
|
185
|
+
* @param b - Second expression to compare
|
|
186
|
+
* @returns BooleanExpr that is true if a <= b
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* East.lessEqual(1n, 1n) // true
|
|
191
|
+
* East.lessEqual(2n, 1n) // false
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
lessEqual: typeof lessEqual;
|
|
195
|
+
/**
|
|
196
|
+
* Greater-than comparison using East's total ordering.
|
|
197
|
+
*
|
|
198
|
+
* @param a - First expression to compare
|
|
199
|
+
* @param b - Second expression to compare
|
|
200
|
+
* @returns BooleanExpr that is true if a > b
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* East.greater(2n, 1n) // true
|
|
205
|
+
* East.greater("banana", "apple") // true
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
greater: typeof greater;
|
|
209
|
+
/**
|
|
210
|
+
* Greater-than-or-equal comparison using East's total ordering.
|
|
211
|
+
*
|
|
212
|
+
* @param a - First expression to compare
|
|
213
|
+
* @param b - Second expression to compare
|
|
214
|
+
* @returns BooleanExpr that is true if a >= b
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* East.greaterEqual(2n, 2n) // true
|
|
219
|
+
* East.greaterEqual(1n, 2n) // false
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
greaterEqual: typeof greaterEqual;
|
|
223
|
+
/**
|
|
224
|
+
* Reference equality comparison for mutable types (Array, Set, Dict).
|
|
225
|
+
* Checks if two expressions reference the same object in memory.
|
|
226
|
+
*
|
|
227
|
+
* @param a - First expression to compare
|
|
228
|
+
* @param b - Second expression to compare
|
|
229
|
+
* @returns BooleanExpr that is true if they reference the same object
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* const arr = $.let(East.value([1n, 2n]));
|
|
234
|
+
* East.is(arr, arr) // true (same reference)
|
|
235
|
+
* East.is([1n, 2n], [1n, 2n]) // false (different objects)
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
is: typeof is;
|
|
239
|
+
/**
|
|
240
|
+
* Returns the minimum of two values using East's total ordering.
|
|
241
|
+
*
|
|
242
|
+
* @param a - First value
|
|
243
|
+
* @param b - Second value
|
|
244
|
+
* @returns The smaller of the two values
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* East.min(5n, 3n) // 3n
|
|
249
|
+
* East.min(3.14, 2.71) // 2.71
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
min: typeof Expr.min;
|
|
253
|
+
/**
|
|
254
|
+
* Returns the maximum of two values using East's total ordering.
|
|
255
|
+
*
|
|
256
|
+
* @param a - First value
|
|
257
|
+
* @param b - Second value
|
|
258
|
+
* @returns The larger of the two values
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```ts
|
|
262
|
+
* East.max(5n, 3n) // 5n
|
|
263
|
+
* East.max(3.14, 2.71) // 3.14
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
max: typeof Expr.max;
|
|
267
|
+
/**
|
|
268
|
+
* Clamps a value between minimum and maximum bounds.
|
|
269
|
+
*
|
|
270
|
+
* @param value - The value to clamp
|
|
271
|
+
* @param min - The minimum bound
|
|
272
|
+
* @param max - The maximum bound
|
|
273
|
+
* @returns The clamped value
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* East.clamp(5n, 0n, 10n) // 5n
|
|
278
|
+
* East.clamp(-5n, 0n, 10n) // 0n
|
|
279
|
+
* East.clamp(15n, 0n, 10n) // 10n
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
clamp: typeof Expr.clamp;
|
|
283
|
+
/**
|
|
284
|
+
* Standard library functions for Integer operations.
|
|
285
|
+
* Provides formatting, rounding, and utility functions for integers.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```ts
|
|
289
|
+
* East.Integer.printCommaSeperated(1234567n) // "1,234,567"
|
|
290
|
+
* East.Integer.printCompact(1500000n) // "1.5M"
|
|
291
|
+
* East.Integer.printOrdinal(42n) // "42nd"
|
|
292
|
+
* East.Integer.roundNearest(47n, 10n) // 50n
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
Integer: {
|
|
296
|
+
printCommaSeperated: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType], import("../types.js").StringType>;
|
|
297
|
+
printCompact: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType], import("../types.js").StringType>;
|
|
298
|
+
printCompactSI: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType], import("../types.js").StringType>;
|
|
299
|
+
printCompactComputing: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType], import("../types.js").StringType>;
|
|
300
|
+
printOrdinal: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType], import("../types.js").StringType>;
|
|
301
|
+
digitCount: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType], import("../types.js").IntegerType>;
|
|
302
|
+
roundNearest: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType, import("../types.js").IntegerType], import("../types.js").IntegerType>;
|
|
303
|
+
roundUp: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType, import("../types.js").IntegerType], import("../types.js").IntegerType>;
|
|
304
|
+
roundDown: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType, import("../types.js").IntegerType], import("../types.js").IntegerType>;
|
|
305
|
+
roundTruncate: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType, import("../types.js").IntegerType], import("../types.js").IntegerType>;
|
|
306
|
+
printPercentage: import("./function.js").CallableFunctionExpr<[import("../types.js").IntegerType], import("../types.js").StringType>;
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Standard library functions for Float operations.
|
|
310
|
+
* Provides rounding, formatting, and comparison functions for floating-point numbers.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```ts
|
|
314
|
+
* East.Float.roundToDecimals(3.14159, 2n) // 3.14
|
|
315
|
+
* East.Float.printCurrency(1234.56) // "$1234.56"
|
|
316
|
+
* East.Float.printPercentage(0.452, 1n) // "45.2%"
|
|
317
|
+
* East.Float.approxEqual(0.1, 0.10001, 0.001) // true
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
Float: {
|
|
321
|
+
approxEqual: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType, import("../types.js").FloatType, import("../types.js").FloatType], import("../types.js").BooleanType>;
|
|
322
|
+
roundFloor: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType], import("../types.js").IntegerType>;
|
|
323
|
+
roundCeil: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType], import("../types.js").IntegerType>;
|
|
324
|
+
roundHalf: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType], import("../types.js").IntegerType>;
|
|
325
|
+
roundTrunc: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType], import("../types.js").IntegerType>;
|
|
326
|
+
roundNearest: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType, import("../types.js").FloatType], import("../types.js").FloatType>;
|
|
327
|
+
roundUp: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType, import("../types.js").FloatType], import("../types.js").FloatType>;
|
|
328
|
+
roundDown: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType, import("../types.js").FloatType], import("../types.js").FloatType>;
|
|
329
|
+
roundTruncate: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType, import("../types.js").FloatType], import("../types.js").FloatType>;
|
|
330
|
+
roundToDecimals: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType, import("../types.js").IntegerType], import("../types.js").FloatType>;
|
|
331
|
+
printCommaSeperated: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType, import("../types.js").IntegerType], import("../types.js").StringType>;
|
|
332
|
+
printCurrency: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType], import("../types.js").StringType>;
|
|
333
|
+
printFixed: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType, import("../types.js").IntegerType], import("../types.js").StringType>;
|
|
334
|
+
printCompact: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType], import("../types.js").StringType>;
|
|
335
|
+
printPercentage: import("./function.js").CallableFunctionExpr<[import("../types.js").FloatType, import("../types.js").IntegerType], import("../types.js").StringType>;
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* Standard library functions for DateTime operations.
|
|
339
|
+
* Provides construction, parsing, and rounding functions for date/time values.
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```ts
|
|
343
|
+
* East.DateTime.fromEpochMilliseconds(1640000000000n)
|
|
344
|
+
* East.DateTime.fromComponents(2025n, 1n, 15n, 10n, 30n)
|
|
345
|
+
* East.DateTime.roundDownDay(date, 1n)
|
|
346
|
+
* East.DateTime.parseFormatted("%Y-%m-%d", "2025-01-15")
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
DateTime: {
|
|
350
|
+
fromEpochMilliseconds: typeof import("./datetime.js").fromEpochMilliseconds;
|
|
351
|
+
fromComponents: typeof import("./datetime.js").fromComponents;
|
|
352
|
+
parseFormatted: typeof import("./datetime.js").parseFormatted;
|
|
353
|
+
roundDownMillisecond: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
354
|
+
roundDownSecond: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
355
|
+
roundDownMinute: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
356
|
+
roundDownHour: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
357
|
+
roundUpMillisecond: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
358
|
+
roundNearestMillisecond: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
359
|
+
roundUpSecond: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
360
|
+
roundNearestSecond: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
361
|
+
roundUpMinute: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
362
|
+
roundNearestMinute: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
363
|
+
roundUpHour: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
364
|
+
roundNearestHour: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
365
|
+
roundDownDay: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
366
|
+
roundUpDay: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
367
|
+
roundNearestDay: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
368
|
+
roundDownWeek: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
369
|
+
roundUpWeek: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
370
|
+
roundNearestWeek: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
371
|
+
roundDownMonth: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
372
|
+
roundDownYear: import("./function.js").CallableFunctionExpr<[import("../types.js").DateTimeType, import("../types.js").IntegerType], import("../types.js").DateTimeType>;
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Standard library functions for String operations.
|
|
376
|
+
* Provides error formatting utilities.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* East.String.printError(errorMsg, stackTrace)
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
String: {
|
|
384
|
+
printError(message: import("./string.js").StringExpr, stack: import("./array.js").ArrayExpr<import("../types.js").StructType<{
|
|
385
|
+
filename: import("../types.js").StringType;
|
|
386
|
+
line: import("../types.js").IntegerType;
|
|
387
|
+
column: import("../types.js").IntegerType;
|
|
388
|
+
}>>): import("./string.js").StringExpr;
|
|
389
|
+
printJson(value: Expr): import("./string.js").StringExpr;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Standard library functions for Blob operations.
|
|
393
|
+
* Provides binary encoding utilities.
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```ts
|
|
397
|
+
* East.Blob.encodeBeast(myValue, 'v2') // Encode to BEAST format
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
Blob: {
|
|
401
|
+
encodeBeast(value: Expr, version?: "v1" | "v2"): import("./blob.js").BlobExpr;
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Standard library functions for Array operations.
|
|
405
|
+
* Provides generation utilities for creating arrays.
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```ts
|
|
409
|
+
* East.Array.range(0n, 10n, 2n) // [0n, 2n, 4n, 6n, 8n]
|
|
410
|
+
* East.Array.linspace(0.0, 1.0, 11n) // [0.0, 0.1, ..., 1.0]
|
|
411
|
+
* East.Array.generate(5n, IntegerType, ($, i) => i.multiply(i))
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
Array: {
|
|
415
|
+
range(start: Expr<import("../types.js").IntegerType> | bigint, end: Expr<import("../types.js").IntegerType> | bigint, step?: Expr<import("../types.js").IntegerType> | bigint): import("./types.js").ExprType<import("../types.js").ArrayType<import("../types.js").IntegerType>>;
|
|
416
|
+
linspace(start: Expr<import("../types.js").FloatType> | number, stop: Expr<import("../types.js").FloatType> | number, size: Expr<import("../types.js").IntegerType> | bigint): import("./types.js").ExprType<import("../types.js").ArrayType<import("../types.js").FloatType>>;
|
|
417
|
+
generate<T>(size: Expr<import("../types.js").IntegerType> | bigint, valueType: T, valueFn: import("./types.js").SubtypeExprOrValue<import("../types.js").FunctionType<[import("../types.js").IntegerType], NoInfer<T>>>): import("./types.js").ExprType<import("../types.js").ArrayType<T>>;
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* Standard library functions for Set operations.
|
|
421
|
+
* Provides generation utilities for creating sets.
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```ts
|
|
425
|
+
* East.Set.generate(5n, IntegerType, ($, i) => i.multiply(2n))
|
|
426
|
+
* ```
|
|
427
|
+
*/
|
|
428
|
+
Set: {
|
|
429
|
+
generate<K extends import("../types.js").EastType>(size: Expr<import("../types.js").IntegerType> | bigint, keyType: K, keyFn: import("./types.js").SubtypeExprOrValue<import("../types.js").FunctionType<[import("../types.js").IntegerType], NoInfer<K>>>, onConflict?: import("./types.js").SubtypeExprOrValue<import("../types.js").FunctionType<[NoInfer<K>], NoInfer<K>>>): import("./types.js").ExprType<import("../types.js").SetType<K>>;
|
|
430
|
+
};
|
|
431
|
+
/**
|
|
432
|
+
* Standard library functions for Dict operations.
|
|
433
|
+
* Provides generation utilities for creating dictionaries.
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* ```ts
|
|
437
|
+
* East.Dict.generate(
|
|
438
|
+
* 5n,
|
|
439
|
+
* IntegerType,
|
|
440
|
+
* IntegerType,
|
|
441
|
+
* ($, i) => i,
|
|
442
|
+
* ($, i) => i.multiply(10n)
|
|
443
|
+
* )
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
446
|
+
Dict: {
|
|
447
|
+
generate<K extends import("../types.js").EastType, V extends import("../types.js").EastType>(size: Expr<import("../types.js").IntegerType> | bigint, keyType: K, valueType: V, keyFn: import("./types.js").SubtypeExprOrValue<import("../types.js").FunctionType<[import("../types.js").IntegerType], NoInfer<K>>>, valueFn: import("./types.js").SubtypeExprOrValue<import("../types.js").FunctionType<[import("../types.js").IntegerType], NoInfer<V>>>, onConflict?: import("./types.js").SubtypeExprOrValue<import("../types.js").FunctionType<[NoInfer<V>, NoInfer<V>, NoInfer<K>], NoInfer<V>>>): import("./types.js").ExprType<import("../types.js").DictType<K, V>>;
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/expr/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3H,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAgB1C,YAAY,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAwBvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,IAAI;IAGf;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;OAYG;;IAGH;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