/** * Value model for the `compute` declarative computation layer. * * Exactly three value types (spec §5): `int` (signed 64-bit, held as BigInt so * the semantics match the future Python/Java ports), `str` (Unicode string), and * `list` (ordered sequence of int|str). There is no boolean and no float. * * Coercion rules (spec §8): * - Arithmetic coerces a *1-character digit* string to int; a multi-character * or non-numeric string in an arithmetic slot is an error (use ). * - String contexts (, , , final output) coerce an int to * its decimal form; a whole list is never a string. * * All runtime failures throw `ComputeError`; static/structural problems are * caught earlier by the validator (`checkCompute`). */ export type Value = { readonly t: 'int'; readonly v: bigint; } | { readonly t: 'str'; readonly v: string; } | { readonly t: 'list'; readonly v: readonly Value[]; }; /** Runtime error raised while evaluating a compute tree. */ export declare class ComputeError extends Error { constructor(message: string); } export declare const INT64_MIN: bigint; export declare const INT64_MAX: bigint; /** Wrap a BigInt as an `int` value, guarding the signed 64-bit range. */ export declare function int(v: bigint): Value; /** Wrap a string as a `str` value. */ export declare function str(v: string): Value; /** Wrap an array as a `list` value. */ export declare function list(v: readonly Value[]): Value; /** Throw if `v` leaves the signed 64-bit range; otherwise return it unchanged. */ export declare function guard64(v: bigint): bigint; /** * Coerce a value to `bigint` for arithmetic. An int passes through; a * *single* digit character coerces; anything else is an error — a multi-digit * string must be converted explicitly with , which keeps the intent * unambiguous. */ export declare function coerceInt(value: Value, context?: string): bigint; /** * What a value IS, for a message that has to say so. * * Worth a helper rather than a literal at each site: `` of an `` * reported "expected a string, got a list", because the one branch that could * not be a string had the wrong type written into it by hand. A reader who * believes that message goes looking for a list they never wrote. */ export declare function typeName(value: Value): string; /** Coerce an int or str to its string form. A list is never a string. */ export declare function coerceStr(value: Value): string; /** Final compute output: an int or str renders to text; a list is an error. */ export declare function valueToOutput(value: Value): string; /** Parse a `` string: all decimal digits, optional leading `-`. */ export declare function parseIntStrict(s: string): bigint; /** * Euclidean remainder: always non-negative, in `[0, |b|)`, independent of the * host language's native `%` sign convention (spec §7.4). */ export declare function euclideanMod(a: bigint, b: bigint): bigint; /** Floor (toward −∞) integer division (spec §7.4). */ export declare function floorDiv(a: bigint, b: bigint): bigint; //# sourceMappingURL=value.d.ts.map