@calcit/procs 0.5.26 → 0.5.28-a2

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
@@ -1,14 +1,22 @@
1
1
  ### Calcit Scripting Language
2
2
 
3
- > Lisp compiling to JavaScript ES Modules. Runs in Rust(Similar to ClojureScript, but in very different syntax.).
3
+ > Spiritually dialect of ClojureScript. Built with Rust. Also compiles to JavaScript ES Modules.
4
4
 
5
5
  - Home http://calcit-lang.org/
6
- - API Doc(heavily influenced by ClojureScript) http://apis.calcit-lang.org/
7
- - Dev Logs https://github.com/calcit-lang/calcit/discussions
8
- - 视频记录 https://space.bilibili.com/14227306/channel/seriesdetail?sid=281171
6
+ - API Doc http://apis.calcit-lang.org/
7
+ - Guidebook http://guide.calcit-lang.org/
9
8
 
10
9
  [Browse examples](https://github.com/calcit-lang/calcit/tree/main/calcit) or also [try WASM version online](https://github.com/calcit-lang/calcit-wasm-play).
11
10
 
11
+ Core design:
12
+
13
+ - Interpreter runs on Rust, extensible with Rust FFI
14
+ - Persistent Data Structure
15
+ - Structural Editor(with indentation-based syntax as a fallback)
16
+ - Lisp macros, functional style
17
+ - Compiles to JavaScript in ES Modules, JavaScript Interop
18
+ - Hot code swapping friendly
19
+
12
20
  ### Install
13
21
 
14
22
  Build and install with Rust:
@@ -21,7 +29,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
21
29
  cargo install calcit
22
30
  ```
23
31
 
24
- For Ubuntu 20.04, try binaries from http://bin.calcit-lang.org/linux/ , which are provided for [CI usages](https://github.com/calcit-lang/respo-calcit-workflow/blob/main/.github/workflows/upload.yaml#L28-L37).
32
+ For Ubuntu latest, try binaries from http://bin.calcit-lang.org/linux/ , which are provided for [CI usages](https://github.com/calcit-lang/respo-calcit-workflow/blob/main/.github/workflows/upload.yaml#L28-L37).
25
33
 
26
34
  ### Usage
27
35
 
@@ -46,7 +54,7 @@ println "|a demo"
46
54
  '
47
55
  ```
48
56
 
49
- Run with a [compact.cirru](https://github.com/calcit-lang/lilac/blob/master/compact.cirru):
57
+ Run with a [compact.cirru](https://github.com/calcit-lang/lilac/blob/main/compact.cirru):
50
58
 
51
59
  ```bash
52
60
  cr compact.cirru -1 # run only once
@@ -56,13 +64,20 @@ cr compact.cirru # watch mode enabled by default
56
64
  cr compact.cirru --init-fn='app.main/main!' # specifying init-fn
57
65
  ```
58
66
 
59
- Emitting code:
67
+ ### JavaScript codegen
68
+
69
+ It compiles to JavaScript and runs in consistet semantics. However it might require a lot of JavaScript interop.
60
70
 
61
71
  ```bash
62
72
  cr compact.cirru --emit-js # compile to js
63
73
  cr compact.cirru --emit-js --emit-path=out/ # compile to js and save in `out/`
74
+ ```
64
75
 
65
- cr compact.cirru --emit-ir # compiles intermediate representation into program-ir.cirru
76
+ By default, js code is generated to `js-out/`. You will need Vite or Esbuild to run it, from an entry file:
77
+
78
+ ```js
79
+ import { main_$x_, reload_$x_ } from "./js-out/app.main.js";
80
+ main_$x_();
66
81
  ```
67
82
 
68
83
  ### Calcit Editor & Bundler
@@ -92,33 +107,6 @@ Modules that ends with `/`s are automatically suffixed `compact.cirru` since it'
92
107
 
93
108
  To load modules in CI environments, make use of `git clone`.
94
109
 
95
- Web Frameworks:
96
-
97
- - [Respo](https://github.com/Respo/respo.calcit) - tiny Virtual DOM library
98
- - [Phlox](https://github.com/Phlox-GL/phlox) - wraps PIXI.js in Virtual DOM style
99
- - [Quamolit](https://github.com/Quamolit/quamolit.calcit/) - wraps Three.js in Virtual DOM style
100
- - [Quatrefoil](https://github.com/Quatrefoil-GL/quatrefoil) - Canvas API in virtual DOM style, with ticking rendering
101
-
102
- Mini libraries:
103
-
104
- - [Lilac](https://github.com/calcit-lang/lilac), data validation tool
105
- - [Memof](https://github.com/calcit-lang/memof), caching tool
106
- - [Recollect](https://github.com/calcit-lang/recollect), diffing tool
107
- - [Calcit Test](https://github.com/calcit-lang/calcit-test), testing tool
108
- - [Bisection Key](https://github.com/calcit-lang/bisection-key), ...
109
- - [Lilac Parser](https://github.com/calcit-lang/lilac-parser), string parsing tool
110
-
111
- ### Extensions
112
-
113
- Rust supports extending with dynamic libraries, found an example in [dylib-workflow](https://github.com/calcit-lang/dylib-workflow). Currently there are some early extensions:
114
-
115
- - [Std](https://github.com/calcit-lang/calcit.std) - some collections of util functions
116
- - [WebSocket server binding](https://github.com/calcit-lang/calcit-wss)
117
- - [HTTP client binding](https://github.com/calcit-lang/calcit-fetch)
118
- - [HTTP server binding](https://github.com/calcit-lang/calcit-http)
119
- - [Wasmtime binding](https://github.com/calcit-lang/calcit_wasmtime)
120
- - [Canvas demo](https://github.com/calcit-lang/calcit-paint)
121
-
122
110
  ### Development
123
111
 
124
112
  I use these commands to run local examples:
@@ -132,6 +120,8 @@ cargo run --bin cr -- calcit/test.cirru --emit-js -1 && yarn try-js
132
120
 
133
121
  # run snippet
134
122
  cargo run --bin cr -- -e 'range 100'
123
+
124
+ cr compact.cirru --emit-ir # compiles intermediate representation into program-ir.cirru
135
125
  ```
136
126
 
137
127
  - [Cirru Parser](https://github.com/Cirru/parser.rs) for indentation-based syntax parsing.
@@ -143,6 +133,11 @@ Other tools:
143
133
  - [Error Viewer](https://github.com/calcit-lang/calcit-error-viewer) for displaying `.calcit-error.cirru`
144
134
  - [IR Viewer](https://github.com/calcit-lang/calcit-ir-viewer) for rendering `program-ir.cirru`
145
135
 
136
+ Some resources:
137
+
138
+ - Dev Logs https://github.com/calcit-lang/calcit/discussions
139
+ - 视频记录 https://space.bilibili.com/14227306/channel/seriesdetail?sid=281171
140
+
146
141
  ### License
147
142
 
148
143
  MIT
@@ -1,12 +1,12 @@
1
1
  import { overwriteHashGenerator, valueHash, mergeValueHash } from "@calcit/ternary-tree";
2
2
  import { overwriteComparator } from "@calcit/ternary-tree";
3
- import { overwriteMapComparator } from "./js-map";
4
- import { CalcitRecord, fieldsEqual } from "./js-record";
5
- import { CalcitMap, CalcitSliceMap } from "./js-map";
6
- import "./js-primes";
7
- import { CalcitList, CalcitSliceList } from "./js-list";
8
- import { CalcitSet, overwriteSetComparator } from "./js-set";
9
- import { CalcitTuple } from "./js-tuple";
3
+ import { overwriteMapComparator } from "./js-map.mjs";
4
+ import { CalcitRecord, fieldsEqual } from "./js-record.mjs";
5
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
6
+ import "./js-primes.mjs";
7
+ import { CalcitList, CalcitSliceList } from "./js-list.mjs";
8
+ import { CalcitSet, overwriteSetComparator } from "./js-set.mjs";
9
+ import { CalcitTuple } from "./js-tuple.mjs";
10
10
  // we have to inject cache in a dirty way in some cases
11
11
  const calcit_dirty_hash_key = "_calcit_cached_hash";
12
12
  let keywordIdx = 0;
@@ -1,26 +1,26 @@
1
1
  var _a;
2
2
  // CALCIT VERSION
3
- export const calcit_version = "0.5.26";
3
+ export const calcit_version = "0.5.28-a2";
4
4
  import "@calcit/ternary-tree";
5
5
  import { parse } from "@cirru/parser.ts";
6
6
  import { writeCirruCode } from "@cirru/writer.ts";
7
- import "./js-primes";
8
- import { CalcitSymbol, CalcitKeyword, CalcitRef, CalcitRecur, kwd, refsRegistry, toString, getStringName, _$n__$e_ } from "./calcit-data";
9
- import { CalcitRecord } from "./js-record";
10
- export * from "./calcit-data";
11
- export * from "./js-record";
12
- export * from "./js-map";
13
- export * from "./js-list";
14
- export * from "./js-set";
15
- export * from "./js-primes";
16
- export * from "./js-tuple";
17
- export * from "./custom-formatter";
18
- export * from "./js-cirru";
19
- import { CalcitList, CalcitSliceList, foldl } from "./js-list";
20
- import { CalcitMap, CalcitSliceMap } from "./js-map";
21
- import { CalcitSet } from "./js-set";
22
- import { CalcitTuple } from "./js-tuple";
23
- import { to_calcit_data, extract_cirru_edn } from "./js-cirru";
7
+ import "./js-primes.mjs";
8
+ import { CalcitSymbol, CalcitKeyword, CalcitRef, CalcitRecur, kwd, refsRegistry, toString, getStringName, _$n__$e_, } from "./calcit-data.mjs";
9
+ import { CalcitRecord } from "./js-record.mjs";
10
+ export * from "./calcit-data.mjs";
11
+ export * from "./js-record.mjs";
12
+ export * from "./js-map.mjs";
13
+ export * from "./js-list.mjs";
14
+ export * from "./js-set.mjs";
15
+ export * from "./js-primes.mjs";
16
+ export * from "./js-tuple.mjs";
17
+ export * from "./custom-formatter.mjs";
18
+ export * from "./js-cirru.mjs";
19
+ import { CalcitList, CalcitSliceList, foldl } from "./js-list.mjs";
20
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
21
+ import { CalcitSet } from "./js-set.mjs";
22
+ import { CalcitTuple } from "./js-tuple.mjs";
23
+ import { to_calcit_data, extract_cirru_edn } from "./js-cirru.mjs";
24
24
  let inNodeJs = typeof process !== "undefined" && ((_a = process === null || process === void 0 ? void 0 : process.release) === null || _a === void 0 ? void 0 : _a.name) === "node";
25
25
  export let type_of = (x) => {
26
26
  if (typeof x === "string") {
@@ -455,7 +455,7 @@ export let _$n_list_$o_rest = (xs) => {
455
455
  };
456
456
  export let _$n_str_$o_rest = (xs) => {
457
457
  if (typeof xs === "string")
458
- return xs.substr(1);
458
+ return xs.slice(1);
459
459
  console.error(xs);
460
460
  throw new Error("Expects a string");
461
461
  };
@@ -520,7 +520,7 @@ export let butlast = (xs) => {
520
520
  return xs.slice(0, xs.len() - 1);
521
521
  }
522
522
  if (typeof xs === "string") {
523
- return xs.substr(0, xs.length - 1);
523
+ return xs.slice(0, -1);
524
524
  }
525
525
  console.error(xs);
526
526
  throw new Error("Data not ready for butlast");
@@ -1,11 +1,10 @@
1
- import "./js-primes";
2
- import { CalcitRef, CalcitSymbol, CalcitKeyword } from "./calcit-data";
3
- import "@calcit/ternary-tree";
4
- import { CalcitRecord } from "./js-record";
5
- import { CalcitMap, CalcitSliceMap } from "./js-map";
6
- import { CalcitList, CalcitSliceList } from "./js-list";
7
- import { CalcitSet } from "./js-set";
8
- import { CalcitTuple } from "./js-tuple";
1
+ import "./js-primes.mjs";
2
+ import { CalcitRef, CalcitSymbol, CalcitKeyword } from "./calcit-data.mjs";
3
+ import { CalcitRecord } from "./js-record.mjs";
4
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
5
+ import { CalcitList, CalcitSliceList } from "./js-list.mjs";
6
+ import { CalcitSet } from "./js-set.mjs";
7
+ import { CalcitTuple } from "./js-tuple.mjs";
9
8
  let embedObject = (x) => {
10
9
  if (x == null) {
11
10
  return null;
@@ -1,12 +1,12 @@
1
1
  import "@calcit/ternary-tree";
2
2
  import { writeCirruCode } from "@cirru/writer.ts";
3
- import "./js-primes";
4
- import { CalcitList, CalcitSliceList } from "./js-list";
5
- import { CalcitRecord } from "./js-record";
6
- import { CalcitMap, CalcitSliceMap } from "./js-map";
7
- import { CalcitSet } from "./js-set";
8
- import { CalcitKeyword, CalcitSymbol, CalcitRecur, CalcitRef, kwd } from "./calcit-data";
9
- import { CalcitTuple } from "./js-tuple";
3
+ import "./js-primes.mjs";
4
+ import { CalcitList, CalcitSliceList } from "./js-list.mjs";
5
+ import { CalcitRecord } from "./js-record.mjs";
6
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
7
+ import { CalcitSet } from "./js-set.mjs";
8
+ import { CalcitKeyword, CalcitSymbol, CalcitRecur, CalcitRef, kwd } from "./calcit-data.mjs";
9
+ import { CalcitTuple } from "./js-tuple.mjs";
10
10
  export let format_cirru = (data, useInline) => {
11
11
  let chunk = toWriterNode(data);
12
12
  if (!Array.isArray(chunk)) {
@@ -108,10 +108,10 @@ export let extract_cirru_edn = (x) => {
108
108
  return x.slice(1);
109
109
  }
110
110
  if (x[0] === ":") {
111
- return kwd(x.substr(1));
111
+ return kwd(x.slice(1));
112
112
  }
113
113
  if (x[0] === "'") {
114
- return new CalcitSymbol(x.substr(1));
114
+ return new CalcitSymbol(x.slice(1));
115
115
  }
116
116
  if (x.match(/^(-?)\d+(\.\d*$)?/)) {
117
117
  return parseFloat(x);
@@ -1,10 +1,10 @@
1
1
  import * as ternaryTree from "@calcit/ternary-tree";
2
- import "./js-primes";
2
+ import "./js-primes.mjs";
3
3
  import { initTernaryTreeList, initTernaryTreeListFromRange, listLen, listGet, assocList, listToItems, dissocList, assocBefore, assocAfter, } from "@calcit/ternary-tree";
4
- import { CalcitMap, CalcitSliceMap } from "./js-map";
5
- import { CalcitSet } from "./js-set";
6
- import { CalcitTuple } from "./js-tuple";
7
- import { isNestedCalcitData, tipNestedCalcitData, toString } from "./calcit-data";
4
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
5
+ import { CalcitSet } from "./js-set.mjs";
6
+ import { CalcitTuple } from "./js-tuple.mjs";
7
+ import { isNestedCalcitData, tipNestedCalcitData, toString } from "./calcit-data.mjs";
8
8
  // two list implementations, should offer same interface
9
9
  export class CalcitList {
10
10
  constructor(value) {
@@ -1,8 +1,8 @@
1
1
  import * as ternaryTree from "@calcit/ternary-tree";
2
- import "./js-primes";
3
- import { CalcitSet } from "./js-set";
2
+ import "./js-primes.mjs";
3
+ import { CalcitSet } from "./js-set.mjs";
4
4
  import { mapLen, assocMap, dissocMap, isMapEmpty, toPairsArray, mapGetDefault, initEmptyTernaryTreeMap, initTernaryTreeMapFromArray, } from "@calcit/ternary-tree";
5
- import { isNestedCalcitData, tipNestedCalcitData, toString } from "./calcit-data";
5
+ import { isNestedCalcitData, tipNestedCalcitData, toString } from "./calcit-data.mjs";
6
6
  /** need to compare by Calcit */
7
7
  let DATA_EQUAL = (x, y) => {
8
8
  return x === y;
@@ -0,0 +1,6 @@
1
+ import "./calcit-data.mjs";
2
+ import "./js-list.mjs";
3
+ import "./js-record.mjs";
4
+ import "./js-map.mjs";
5
+ import "./js-set.mjs";
6
+ import "./js-tuple.mjs";
@@ -1,7 +1,7 @@
1
1
  import "@calcit/ternary-tree";
2
- import "./js-primes";
3
- import { castKwd, toString, findInFields } from "./calcit-data";
4
- import { CalcitMap, CalcitSliceMap } from "./js-map";
2
+ import "./js-primes.mjs";
3
+ import { castKwd, toString, findInFields } from "./calcit-data.mjs";
4
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
5
5
  export class CalcitRecord {
6
6
  constructor(name, fields, values) {
7
7
  this.name = name;
@@ -1,5 +1,5 @@
1
- import "./js-primes";
2
- import { toString } from "./calcit-data";
1
+ import "./js-primes.mjs";
2
+ import { toString } from "./calcit-data.mjs";
3
3
  import { mapLen, assocMap, dissocMap, toPairsArray, contains, initTernaryTreeMapFromArray, initEmptyTernaryTreeMap, } from "@calcit/ternary-tree";
4
4
  import * as ternaryTree from "@calcit/ternary-tree";
5
5
  /** need to compare by Calcit */
@@ -1,4 +1,4 @@
1
- import "./js-primes";
1
+ import "./js-primes.mjs";
2
2
  import "@calcit/ternary-tree";
3
3
  export class CalcitTuple {
4
4
  constructor(a, b) {
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.5.26",
4
- "main": "./lib/calcit.procs.js",
3
+ "version": "0.5.28-a2",
4
+ "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
- "@types/node": "^17.0.21",
7
- "esbuild": "^0.14.25",
6
+ "@types/node": "^17.0.22",
7
+ "esbuild": "^0.14.27",
8
8
  "typescript": "^4.6.2"
9
9
  },
10
10
  "scripts": {
11
11
  "compile": "rm -rfv lib/* && tsc",
12
12
  "procs-link": "ln -s ../../ node_modules/@calcit/procs",
13
- "bundle-main": "esbuild js-out/main.js --bundle --outfile=js-out/bundle.js --platform=node",
13
+ "bundle-main": "esbuild js-out/main.mjs --bundle --outfile=js-out/bundle.js --platform=node --resolve-extensions=.mjs,.js",
14
14
  "cp-mac": "cargo build --release && rm -rfv builds/* && node scripts/cp-version.js && scp builds/* rsync-user@calcit-lang.org:/web-assets/repo/calcit-lang/binaries/macos/",
15
15
  "try-rs": "cargo run --bin cr -- calcit/test.cirru -1",
16
16
  "try-js": "cargo run --bin cr -- calcit/test.cirru --emit-js -1 && yarn bundle-main && node js-out/bundle.js"
@@ -20,7 +20,7 @@
20
20
  "url": "https://github.com/calcit-lang/calcit"
21
21
  },
22
22
  "dependencies": {
23
- "@calcit/ternary-tree": "0.0.18",
23
+ "@calcit/ternary-tree": "0.0.19-a1",
24
24
  "@cirru/parser.ts": "^0.0.5",
25
25
  "@cirru/writer.ts": "^0.1.3"
26
26
  }
@@ -1,14 +1,14 @@
1
1
  import { Hash, overwriteHashGenerator, valueHash, mergeValueHash } from "@calcit/ternary-tree";
2
2
  import { overwriteComparator, initTernaryTreeMap } from "@calcit/ternary-tree";
3
- import { overwriteMapComparator } from "./js-map";
3
+ import { overwriteMapComparator } from "./js-map.mjs";
4
4
 
5
- import { CalcitRecord, fieldsEqual } from "./js-record";
6
- import { CalcitMap, CalcitSliceMap } from "./js-map";
5
+ import { CalcitRecord, fieldsEqual } from "./js-record.mjs";
6
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
7
7
 
8
- import { CalcitValue } from "./js-primes";
9
- import { CalcitList, CalcitSliceList } from "./js-list";
10
- import { CalcitSet, overwriteSetComparator } from "./js-set";
11
- import { CalcitTuple } from "./js-tuple";
8
+ import { CalcitValue } from "./js-primes.mjs";
9
+ import { CalcitList, CalcitSliceList } from "./js-list.mjs";
10
+ import { CalcitSet, overwriteSetComparator } from "./js-set.mjs";
11
+ import { CalcitTuple } from "./js-tuple.mjs";
12
12
 
13
13
  // we have to inject cache in a dirty way in some cases
14
14
  const calcit_dirty_hash_key = "_calcit_cached_hash";
@@ -1,30 +1,42 @@
1
1
  // CALCIT VERSION
2
- export const calcit_version = "0.5.26";
2
+ export const calcit_version = "0.5.28-a2";
3
3
 
4
4
  import { overwriteComparator, initTernaryTreeMap } from "@calcit/ternary-tree";
5
5
  import { parse, ICirruNode } from "@cirru/parser.ts";
6
6
  import { writeCirruCode } from "@cirru/writer.ts";
7
7
 
8
- import { CalcitValue } from "./js-primes";
9
- import { CalcitSymbol, CalcitKeyword, CalcitRef, CalcitFn, CalcitRecur, kwd, refsRegistry, toString, getStringName, to_js_data, _$n__$e_ } from "./calcit-data";
10
-
11
- import { fieldsEqual, CalcitRecord } from "./js-record";
12
-
13
- export * from "./calcit-data";
14
- export * from "./js-record";
15
- export * from "./js-map";
16
- export * from "./js-list";
17
- export * from "./js-set";
18
- export * from "./js-primes";
19
- export * from "./js-tuple";
20
- export * from "./custom-formatter";
21
- export * from "./js-cirru";
22
-
23
- import { CalcitList, CalcitSliceList, foldl } from "./js-list";
24
- import { CalcitMap, CalcitSliceMap } from "./js-map";
25
- import { CalcitSet } from "./js-set";
26
- import { CalcitTuple } from "./js-tuple";
27
- import { to_calcit_data, extract_cirru_edn } from "./js-cirru";
8
+ import { CalcitValue } from "./js-primes.mjs";
9
+ import {
10
+ CalcitSymbol,
11
+ CalcitKeyword,
12
+ CalcitRef,
13
+ CalcitFn,
14
+ CalcitRecur,
15
+ kwd,
16
+ refsRegistry,
17
+ toString,
18
+ getStringName,
19
+ to_js_data,
20
+ _$n__$e_,
21
+ } from "./calcit-data.mjs";
22
+
23
+ import { fieldsEqual, CalcitRecord } from "./js-record.mjs";
24
+
25
+ export * from "./calcit-data.mjs";
26
+ export * from "./js-record.mjs";
27
+ export * from "./js-map.mjs";
28
+ export * from "./js-list.mjs";
29
+ export * from "./js-set.mjs";
30
+ export * from "./js-primes.mjs";
31
+ export * from "./js-tuple.mjs";
32
+ export * from "./custom-formatter.mjs";
33
+ export * from "./js-cirru.mjs";
34
+
35
+ import { CalcitList, CalcitSliceList, foldl } from "./js-list.mjs";
36
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
37
+ import { CalcitSet } from "./js-set.mjs";
38
+ import { CalcitTuple } from "./js-tuple.mjs";
39
+ import { to_calcit_data, extract_cirru_edn } from "./js-cirru.mjs";
28
40
 
29
41
  let inNodeJs = typeof process !== "undefined" && process?.release?.name === "node";
30
42
 
@@ -499,7 +511,7 @@ export let _$n_list_$o_rest = (xs: CalcitValue): CalcitValue => {
499
511
  };
500
512
 
501
513
  export let _$n_str_$o_rest = (xs: CalcitValue): CalcitValue => {
502
- if (typeof xs === "string") return xs.substr(1);
514
+ if (typeof xs === "string") return xs.slice(1);
503
515
 
504
516
  console.error(xs);
505
517
  throw new Error("Expects a string");
@@ -571,7 +583,7 @@ export let butlast = (xs: CalcitValue): CalcitValue => {
571
583
  return xs.slice(0, xs.len() - 1);
572
584
  }
573
585
  if (typeof xs === "string") {
574
- return xs.substr(0, xs.length - 1);
586
+ return xs.slice(0, -1);
575
587
  }
576
588
  console.error(xs);
577
589
  throw new Error("Data not ready for butlast");
@@ -1,12 +1,11 @@
1
- import { CalcitValue } from "./js-primes";
2
- import { CalcitRef, CalcitSymbol, CalcitKeyword } from "./calcit-data";
3
- import { toPairs } from "@calcit/ternary-tree";
1
+ import { CalcitValue } from "./js-primes.mjs";
2
+ import { CalcitRef, CalcitSymbol, CalcitKeyword } from "./calcit-data.mjs";
4
3
 
5
- import { CalcitRecord } from "./js-record";
6
- import { CalcitMap, CalcitSliceMap } from "./js-map";
7
- import { CalcitList, CalcitSliceList } from "./js-list";
8
- import { CalcitSet } from "./js-set";
9
- import { CalcitTuple } from "./js-tuple";
4
+ import { CalcitRecord } from "./js-record.mjs";
5
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
6
+ import { CalcitList, CalcitSliceList } from "./js-list.mjs";
7
+ import { CalcitSet } from "./js-set.mjs";
8
+ import { CalcitTuple } from "./js-tuple.mjs";
10
9
 
11
10
  declare global {
12
11
  interface Window {
@@ -1,13 +1,13 @@
1
1
  import { overwriteComparator, initTernaryTreeMap } from "@calcit/ternary-tree";
2
2
  import { CirruWriterNode, writeCirruCode } from "@cirru/writer.ts";
3
3
 
4
- import { CalcitValue } from "./js-primes";
5
- import { CalcitList, CalcitSliceList } from "./js-list";
6
- import { CalcitRecord } from "./js-record";
7
- import { CalcitMap, CalcitSliceMap } from "./js-map";
8
- import { CalcitSet } from "./js-set";
9
- import { CalcitKeyword, CalcitSymbol, CalcitRecur, CalcitRef, kwd } from "./calcit-data";
10
- import { CalcitTuple } from "./js-tuple";
4
+ import { CalcitValue } from "./js-primes.mjs";
5
+ import { CalcitList, CalcitSliceList } from "./js-list.mjs";
6
+ import { CalcitRecord } from "./js-record.mjs";
7
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
8
+ import { CalcitSet } from "./js-set.mjs";
9
+ import { CalcitKeyword, CalcitSymbol, CalcitRecur, CalcitRef, kwd } from "./calcit-data.mjs";
10
+ import { CalcitTuple } from "./js-tuple.mjs";
11
11
 
12
12
  type CirruEdnFormat = string | CirruEdnFormat[];
13
13
 
@@ -112,10 +112,10 @@ export let extract_cirru_edn = (x: CirruEdnFormat): CalcitValue => {
112
112
  return x.slice(1);
113
113
  }
114
114
  if (x[0] === ":") {
115
- return kwd(x.substr(1));
115
+ return kwd(x.slice(1));
116
116
  }
117
117
  if (x[0] === "'") {
118
- return new CalcitSymbol(x.substr(1));
118
+ return new CalcitSymbol(x.slice(1));
119
119
  }
120
120
  if (x.match(/^(-?)\d+(\.\d*$)?/)) {
121
121
  return parseFloat(x);
@@ -1,6 +1,6 @@
1
1
  import * as ternaryTree from "@calcit/ternary-tree";
2
2
 
3
- import { CalcitValue } from "./js-primes";
3
+ import { CalcitValue } from "./js-primes.mjs";
4
4
 
5
5
  import {
6
6
  TernaryTreeList,
@@ -16,11 +16,11 @@ import {
16
16
  assocAfter,
17
17
  } from "@calcit/ternary-tree";
18
18
 
19
- import { CalcitMap, CalcitSliceMap } from "./js-map";
20
- import { CalcitSet } from "./js-set";
21
- import { CalcitTuple } from "./js-tuple";
19
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
20
+ import { CalcitSet } from "./js-set.mjs";
21
+ import { CalcitTuple } from "./js-tuple.mjs";
22
22
 
23
- import { isNestedCalcitData, tipNestedCalcitData, toString, CalcitFn } from "./calcit-data";
23
+ import { isNestedCalcitData, tipNestedCalcitData, toString, CalcitFn } from "./calcit-data.mjs";
24
24
 
25
25
  // two list implementations, should offer same interface
26
26
  export class CalcitList {
@@ -1,7 +1,7 @@
1
1
  import * as ternaryTree from "@calcit/ternary-tree";
2
2
 
3
- import { CalcitValue } from "./js-primes";
4
- import { CalcitSet } from "./js-set";
3
+ import { CalcitValue } from "./js-primes.mjs";
4
+ import { CalcitSet } from "./js-set.mjs";
5
5
 
6
6
  import {
7
7
  TernaryTreeMap,
@@ -17,7 +17,7 @@ import {
17
17
  initTernaryTreeMapFromArray,
18
18
  } from "@calcit/ternary-tree";
19
19
 
20
- import { isNestedCalcitData, tipNestedCalcitData, toString } from "./calcit-data";
20
+ import { isNestedCalcitData, tipNestedCalcitData, toString } from "./calcit-data.mjs";
21
21
 
22
22
  /** need to compare by Calcit */
23
23
  let DATA_EQUAL = (x: CalcitValue, y: CalcitValue): boolean => {
@@ -1,9 +1,9 @@
1
- import { CalcitKeyword, CalcitSymbol, CalcitRef, CalcitFn, CalcitRecur } from "./calcit-data";
2
- import { CalcitList, CalcitSliceList } from "./js-list";
3
- import { CalcitRecord } from "./js-record";
4
- import { CalcitMap, CalcitSliceMap } from "./js-map";
5
- import { CalcitSet as CalcitSet } from "./js-set";
6
- import { CalcitTuple } from "./js-tuple";
1
+ import { CalcitKeyword, CalcitSymbol, CalcitRef, CalcitFn, CalcitRecur } from "./calcit-data.mjs";
2
+ import { CalcitList, CalcitSliceList } from "./js-list.mjs";
3
+ import { CalcitRecord } from "./js-record.mjs";
4
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
5
+ import { CalcitSet as CalcitSet } from "./js-set.mjs";
6
+ import { CalcitTuple } from "./js-tuple.mjs";
7
7
 
8
8
  export type CalcitValue =
9
9
  | string
@@ -1,8 +1,8 @@
1
1
  import { initTernaryTreeMap, Hash, insert } from "@calcit/ternary-tree";
2
- import { CalcitValue } from "./js-primes";
3
- import { kwd, castKwd, toString, CalcitKeyword, getStringName, findInFields } from "./calcit-data";
2
+ import { CalcitValue } from "./js-primes.mjs";
3
+ import { kwd, castKwd, toString, CalcitKeyword, getStringName, findInFields } from "./calcit-data.mjs";
4
4
 
5
- import { CalcitMap, CalcitSliceMap } from "./js-map";
5
+ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
6
6
 
7
7
  export class CalcitRecord {
8
8
  name: CalcitKeyword;
@@ -1,5 +1,5 @@
1
- import { CalcitValue } from "./js-primes";
2
- import { toString } from "./calcit-data";
1
+ import { CalcitValue } from "./js-primes.mjs";
2
+ import { toString } from "./calcit-data.mjs";
3
3
  import {
4
4
  TernaryTreeMap,
5
5
  initTernaryTreeMap,
@@ -1,4 +1,4 @@
1
- import { CalcitValue } from "./js-primes";
1
+ import { CalcitValue } from "./js-primes.mjs";
2
2
 
3
3
  import { Hash } from "@calcit/ternary-tree";
4
4
 
package/lib/js-primes.js DELETED
@@ -1,6 +0,0 @@
1
- import "./calcit-data";
2
- import "./js-list";
3
- import "./js-record";
4
- import "./js-map";
5
- import "./js-set";
6
- import "./js-tuple";