@calcit/procs 0.4.33 → 0.4.37-a1

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/README.md CHANGED
@@ -88,7 +88,7 @@ cr -e="range 100" # eval from CLI
88
88
  cr compact.cirru --emit-js # compile to js
89
89
  cr compact.cirru --emit-js --emit-path=out/ # compile to js and save in `out/`
90
90
 
91
- cr compact.cirru --emit-ir # compiles intermediate representation into program-ir.json
91
+ cr compact.cirru --emit-ir # compiles intermediate representation into program-ir.cirru
92
92
 
93
93
  cr compact.cirru --emit-js --mjs # TODO compile to mjs
94
94
  ```
@@ -1,6 +1,6 @@
1
1
  var _a;
2
2
  // CALCIT VERSION
3
- export const calcit_version = "0.4.33";
3
+ export const calcit_version = "0.4.37-a1";
4
4
  import { initTernaryTreeMap } from "@calcit/ternary-tree";
5
5
  import { parse } from "@cirru/parser.ts";
6
6
  import "./js-primes";
package/lib/js-cirru.js CHANGED
@@ -72,6 +72,9 @@ export let to_cirru_edn = (x) => {
72
72
  // turn `x.snd` with CalcitList into raw Cirru nodes, which is in plain Array
73
73
  return ["quote", toWriterNode(x.snd)];
74
74
  }
75
+ else if (x.fst instanceof CalcitRecord) {
76
+ return ["::", "|" + x.fst.name, to_cirru_edn(x.snd)];
77
+ }
75
78
  else {
76
79
  throw new Error(`Unsupported tag for EDN: ${x.fst}`);
77
80
  }
@@ -169,6 +172,12 @@ export let extract_cirru_edn = (x) => {
169
172
  }
170
173
  return new CalcitTuple(new CalcitSymbol("quote"), to_calcit_data(x[1], true));
171
174
  }
175
+ if (x[0] === "::") {
176
+ if (x.length !== 3) {
177
+ throw new Error("tuple expects 2 values");
178
+ }
179
+ return new CalcitTuple(extract_cirru_edn(x[1]), extract_cirru_edn(x[2]));
180
+ }
172
181
  }
173
182
  console.error(x);
174
183
  throw new Error("Unexpected data from cirru-edn");
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.4.33",
3
+ "version": "0.4.37-a1",
4
4
  "main": "./lib/calcit.procs.js",
5
5
  "devDependencies": {
6
- "@types/node": "^16.7.10",
7
- "esbuild": "^0.12.26",
8
- "typescript": "^4.4.2"
6
+ "@types/node": "^16.9.6",
7
+ "esbuild": "^0.13.2",
8
+ "typescript": "^4.4.3"
9
9
  },
10
10
  "scripts": {
11
11
  "compile": "rm -rfv lib/* && tsc",
@@ -1,5 +1,5 @@
1
1
  // CALCIT VERSION
2
- export const calcit_version = "0.4.33";
2
+ export const calcit_version = "0.4.37-a1";
3
3
 
4
4
  import { overwriteComparator, initTernaryTreeMap } from "@calcit/ternary-tree";
5
5
  import { parse } from "@cirru/parser.ts";
@@ -76,6 +76,8 @@ export let to_cirru_edn = (x: CalcitValue): CirruEdnFormat => {
76
76
  if (x.fst instanceof CalcitSymbol && x.fst.value === "quote") {
77
77
  // turn `x.snd` with CalcitList into raw Cirru nodes, which is in plain Array
78
78
  return ["quote", toWriterNode(x.snd as any)] as CirruEdnFormat;
79
+ } else if (x.fst instanceof CalcitRecord) {
80
+ return ["::", "|" + x.fst.name, to_cirru_edn(x.snd)];
79
81
  } else {
80
82
  throw new Error(`Unsupported tag for EDN: ${x.fst}`);
81
83
  }
@@ -172,6 +174,12 @@ export let extract_cirru_edn = (x: CirruEdnFormat): CalcitValue => {
172
174
  }
173
175
  return new CalcitTuple(new CalcitSymbol("quote"), to_calcit_data(x[1], true));
174
176
  }
177
+ if (x[0] === "::") {
178
+ if (x.length !== 3) {
179
+ throw new Error("tuple expects 2 values");
180
+ }
181
+ return new CalcitTuple(extract_cirru_edn(x[1]), extract_cirru_edn(x[2]));
182
+ }
175
183
  }
176
184
  console.error(x);
177
185
  throw new Error("Unexpected data from cirru-edn");