@calcit/procs 0.8.0-a1 → 0.8.0-a3

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.
@@ -1,6 +1,6 @@
1
1
  var _a;
2
2
  // CALCIT VERSION
3
- export const calcit_version = "0.8.0-a1";
3
+ export const calcit_version = "0.8.0-a3";
4
4
  import { parse } from "@cirru/parser.ts";
5
5
  import { writeCirruCode } from "@cirru/writer.ts";
6
6
  import { CalcitSymbol, CalcitTag, CalcitRef, CalcitRecur, newTag, refsRegistry, toString, getStringName, _$n__$e_, hashFunction, } from "./calcit-data.mjs";
@@ -932,7 +932,7 @@ export let turn_symbol = (x) => {
932
932
  console.error(x);
933
933
  throw new Error("Unexpected data for symbol");
934
934
  };
935
- export let pr_str = (...args) => {
935
+ export let to_lispy_string = (...args) => {
936
936
  return args.map((x) => toString(x, true)).join(" ");
937
937
  };
938
938
  /** helper function for println, js only */
package/lib/js-cirru.mjs CHANGED
@@ -109,6 +109,20 @@ export let to_cirru_edn = (x) => {
109
109
  for (let idx = 0; idx < x.fields.length; idx++) {
110
110
  buffer.push([x.fields[idx].toString(), to_cirru_edn(x.values[idx])]);
111
111
  }
112
+ // placed literals first
113
+ buffer.sort((a, b) => {
114
+ let a1_literal = is_literal(a[1]);
115
+ let b1_literal = is_literal(b[1]);
116
+ if (a1_literal && !b1_literal) {
117
+ return -1;
118
+ }
119
+ else if (!a1_literal && b1_literal) {
120
+ return 1;
121
+ }
122
+ else {
123
+ return _$n_compare(a[0], b[0]);
124
+ }
125
+ });
112
126
  return buffer;
113
127
  }
114
128
  if (x instanceof CalcitSet) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.8.0-a1",
3
+ "version": "0.8.0-a3",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^20.4.8",
@@ -1,5 +1,5 @@
1
1
  // CALCIT VERSION
2
- export const calcit_version = "0.8.0-a1";
2
+ export const calcit_version = "0.8.0-a3";
3
3
 
4
4
  import { parse, ICirruNode } from "@cirru/parser.ts";
5
5
  import { writeCirruCode } from "@cirru/writer.ts";
@@ -1023,7 +1023,7 @@ export let turn_symbol = (x: CalcitValue): CalcitSymbol => {
1023
1023
  throw new Error("Unexpected data for symbol");
1024
1024
  };
1025
1025
 
1026
- export let pr_str = (...args: CalcitValue[]): string => {
1026
+ export let to_lispy_string = (...args: CalcitValue[]): string => {
1027
1027
  return args.map((x) => toString(x, true)).join(" ");
1028
1028
  };
1029
1029
 
@@ -108,10 +108,22 @@ export let to_cirru_edn = (x: CalcitValue): CirruEdnFormat => {
108
108
  return buffer;
109
109
  }
110
110
  if (x instanceof CalcitRecord) {
111
- let buffer: CirruEdnFormat = ["%{}", x.name.toString()];
111
+ let buffer: [string, CirruEdnFormat] = ["%{}", x.name.toString()];
112
112
  for (let idx = 0; idx < x.fields.length; idx++) {
113
113
  buffer.push([x.fields[idx].toString(), to_cirru_edn(x.values[idx])]);
114
114
  }
115
+ // placed literals first
116
+ buffer.sort((a, b) => {
117
+ let a1_literal = is_literal(a[1] as CalcitValue);
118
+ let b1_literal = is_literal(b[1] as CalcitValue);
119
+ if (a1_literal && !b1_literal) {
120
+ return -1;
121
+ } else if (!a1_literal && b1_literal) {
122
+ return 1;
123
+ } else {
124
+ return _$n_compare(a[0] as CalcitValue, b[0] as CalcitValue);
125
+ }
126
+ });
115
127
  return buffer;
116
128
  }
117
129
  if (x instanceof CalcitSet) {