@calcit/procs 0.12.23 → 0.12.25

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.
Binary file
package/README.md CHANGED
@@ -161,15 +161,15 @@ I use these commands to run local examples:
161
161
 
162
162
  ```bash
163
163
  # run tests in Rust
164
- cargo run --bin cr -- calcit/test.cirru -1
164
+ cargo run --bin cr -- calcit/test.cirru
165
165
 
166
166
  # run tests in Node.js
167
- cargo run --bin cr -- calcit/test.cirru -1 js && yarn try-js
167
+ cargo run --bin cr -- calcit/test.cirru js && yarn try-js
168
168
 
169
169
  # run snippet
170
170
  cargo run --bin cr -- eval 'range 100'
171
171
 
172
- cr compact.cirru -1 ir # compiles intermediate representation into program-ir.cirru
172
+ cr compact.cirru ir # compiles intermediate representation into program-ir.cirru
173
173
 
174
174
  cr-wasm calcit/test-wasm.cirru # compile standalone wasm target to js-out/program.wasm
175
175
  ```
@@ -52,6 +52,6 @@
52
52
 
53
53
  - `yarn check-all > js-out/check-all.log`,`EXIT:0`
54
54
  - `cargo build --release > js-out/release-build.log`
55
- - `./target/release/cr calcit/test.cirru -1 > js-out/release-run.log`,`EXIT:0`
55
+ - `./target/release/cr calcit/test.cirru > js-out/release-run.log`,`EXIT:0`
56
56
 
57
57
  结论:本次改动仅增强静态类型信息,未改变运行行为,且全量检查通过。
@@ -291,6 +291,14 @@ export function _$n_record_$o_field_tag(x, idx) {
291
291
  throw new Error(`&record:field-tag index ${i} out of bounds (${x.fields.length})`);
292
292
  return x.fields[i];
293
293
  }
294
+ export function _$n_record_$o_nth(x, idx) {
295
+ if (!(x instanceof CalcitRecord))
296
+ throw new Error(`&record:nth expected a record, got ${x}`);
297
+ const i = idx;
298
+ if (i < 0 || i >= x.values.length)
299
+ throw new Error(`&record:nth index ${i} out of range for record with ${x.values.length} fields`);
300
+ return x.values[i];
301
+ }
294
302
  // === BufList — mutable append-only list ===
295
303
  // Wrapper around a plain JS Array for O(1) push.
296
304
  export class CalcitBufList {
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.12.23",
3
+ "version": "0.12.25",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.0.9",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.12.23",
3
+ "version": "0.12.25",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.0.9",
@@ -324,6 +324,13 @@ export function _$n_record_$o_field_tag(x: CalcitValue, idx: CalcitValue): Calci
324
324
  return x.fields[i];
325
325
  }
326
326
 
327
+ export function _$n_record_$o_nth(x: CalcitValue, idx: CalcitValue): CalcitValue {
328
+ if (!(x instanceof CalcitRecord)) throw new Error(`&record:nth expected a record, got ${x}`);
329
+ const i = idx as number;
330
+ if (i < 0 || i >= x.values.length) throw new Error(`&record:nth index ${i} out of range for record with ${x.values.length} fields`);
331
+ return x.values[i];
332
+ }
333
+
327
334
  // === BufList — mutable append-only list ===
328
335
  // Wrapper around a plain JS Array for O(1) push.
329
336
  export class CalcitBufList {