@thi.ng/pointfree 2.0.35 → 3.0.2

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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [2.0.35](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@2.0.34...@thi.ng/pointfree@2.0.35) (2021-08-08)
6
+ ## [3.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@3.0.1...@thi.ng/pointfree@3.0.2) (2021-10-15)
7
7
 
8
8
  **Note:** Version bump only for package @thi.ng/pointfree
9
9
 
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- ## [2.0.34](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@2.0.33...@thi.ng/pointfree@2.0.34) (2021-08-08)
14
+ ## [3.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@3.0.0...@thi.ng/pointfree@3.0.1) (2021-10-13)
15
15
 
16
16
  **Note:** Version bump only for package @thi.ng/pointfree
17
17
 
@@ -19,181 +19,153 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
19
19
 
20
20
 
21
21
 
22
- ## [2.0.33](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@2.0.32...@thi.ng/pointfree@2.0.33) (2021-08-08)
23
-
24
- **Note:** Version bump only for package @thi.ng/pointfree
25
-
26
-
27
-
28
-
29
-
30
- ## [2.0.32](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@2.0.31...@thi.ng/pointfree@2.0.32) (2021-08-04)
31
-
32
- **Note:** Version bump only for package @thi.ng/pointfree
33
-
34
-
35
-
36
-
37
-
38
- ## [2.0.31](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@2.0.30...@thi.ng/pointfree@2.0.31) (2021-07-01)
39
-
40
- **Note:** Version bump only for package @thi.ng/pointfree
41
-
42
-
43
-
44
-
45
-
46
- ## [2.0.30](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@2.0.29...@thi.ng/pointfree@2.0.30) (2021-06-08)
47
-
48
- **Note:** Version bump only for package @thi.ng/pointfree
49
-
22
+ # [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@2.0.36...@thi.ng/pointfree@3.0.0) (2021-10-12)
50
23
 
51
24
 
25
+ ### Build System
52
26
 
27
+ * major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
53
28
 
54
- # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@1.3.3...@thi.ng/pointfree@2.0.0) (2020-04-16)
55
29
 
30
+ ### BREAKING CHANGES
56
31
 
57
- ### Features
32
+ * discontinue CommonJS & UMD versions
58
33
 
59
- * **pointfree:** add new words, rename HOF words ([0d19c9a](https://github.com/thi-ng/umbrella/commit/0d19c9a23de3fc4188d8d0329783211f5013716b)), closes [#210](https://github.com/thi-ng/umbrella/issues/210)
34
+ - only ESM modules will be published from now on
35
+ - CJS obsolete due to ESM support in recent versions of node:
36
+ - i.e. launch NodeJS via:
37
+ - `node --experimental-specifier-resolution=node --experimental-repl-await`
38
+ - in the node REPL use `await import(...)` instead of `require()`
39
+ - UMD obsolete due to widespread browser support for ESM
60
40
 
41
+ Also:
42
+ - normalize/restructure/reorg all package.json files
43
+ - cleanup all build scripts, remove obsolete
44
+ - switch from mocha to @thi.ng/testament for all tests
61
45
 
62
- ### BREAKING CHANGES
63
46
 
64
- * **pointfree:** rename HOF words
65
47
 
66
48
 
67
49
 
68
50
 
51
+ # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@1.3.3...@thi.ng/pointfree@2.0.0) (2020-04-16)
69
52
 
70
- # [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@1.2.10...@thi.ng/pointfree@1.3.0) (2020-03-29)
53
+ ### Features
71
54
 
55
+ - **pointfree:** add new words, rename HOF words ([0d19c9a](https://github.com/thi-ng/umbrella/commit/0d19c9a23de3fc4188d8d0329783211f5013716b)), closes [#210](https://github.com/thi-ng/umbrella/issues/210)
72
56
 
73
- ### Features
57
+ ### BREAKING CHANGES
74
58
 
75
- * **pointfree:** add $try word, update compile() to allow empty quotations ([41de106](https://github.com/thi-ng/umbrella/commit/41de106e776ad102e827ccc062a19a4e637613a0))
76
- * **pointfree:** add tojson()/fromjson() conversion ops ([829f3ab](https://github.com/thi-ng/umbrella/commit/829f3ab129084619c05b434732b46b6c26d32b5e))
77
- * **pointfree:** add whenq(), ismatch() ([44ab1d7](https://github.com/thi-ng/umbrella/commit/44ab1d7f5ff52a9226b873b42adada3eac1674e9))
59
+ - **pointfree:** rename HOF words
78
60
 
61
+ # [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@1.2.10...@thi.ng/pointfree@1.3.0) (2020-03-29)
79
62
 
63
+ ### Features
80
64
 
65
+ - **pointfree:** add $try word, update compile() to allow empty quotations ([41de106](https://github.com/thi-ng/umbrella/commit/41de106e776ad102e827ccc062a19a4e637613a0))
66
+ - **pointfree:** add tojson()/fromjson() conversion ops ([829f3ab](https://github.com/thi-ng/umbrella/commit/829f3ab129084619c05b434732b46b6c26d32b5e))
67
+ - **pointfree:** add whenq(), ismatch() ([44ab1d7](https://github.com/thi-ng/umbrella/commit/44ab1d7f5ff52a9226b873b42adada3eac1674e9))
81
68
 
69
+ # [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@1.1.3...@thi.ng/pointfree@1.2.0) (2019-08-21)
82
70
 
83
- # [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@1.1.3...@thi.ng/pointfree@1.2.0) (2019-08-21)
71
+ ### Features
84
72
 
85
- ### Features
73
+ - **pointfree:** add new r-stack words, refactor ([dbad162](https://github.com/thi-ng/umbrella/commit/dbad162))
86
74
 
87
- * **pointfree:** add new r-stack words, refactor ([dbad162](https://github.com/thi-ng/umbrella/commit/dbad162))
75
+ # [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@1.0.14...@thi.ng/pointfree@1.1.0) (2019-07-07)
88
76
 
89
- # [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@1.0.14...@thi.ng/pointfree@1.1.0) (2019-07-07)
77
+ ### Features
90
78
 
91
- ### Features
79
+ - **pointfree:** enable TS strict compiler flags (refactor) ([1f9d155](https://github.com/thi-ng/umbrella/commit/1f9d155))
92
80
 
93
- * **pointfree:** enable TS strict compiler flags (refactor) ([1f9d155](https://github.com/thi-ng/umbrella/commit/1f9d155))
81
+ ## [1.0.14](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@1.0.13...@thi.ng/pointfree@1.0.14) (2019-05-22)
94
82
 
95
- ## [1.0.14](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@1.0.13...@thi.ng/pointfree@1.0.14) (2019-05-22)
83
+ ### Bug Fixes
96
84
 
97
- ### Bug Fixes
85
+ - **pointfree:** update safeMode handling ([d27bcba](https://github.com/thi-ng/umbrella/commit/d27bcba))
98
86
 
99
- * **pointfree:** update safeMode handling ([d27bcba](https://github.com/thi-ng/umbrella/commit/d27bcba))
87
+ # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.8.15...@thi.ng/pointfree@1.0.0) (2019-01-21)
100
88
 
101
- # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.8.15...@thi.ng/pointfree@1.0.0) (2019-01-21)
89
+ ### Build System
102
90
 
103
- ### Build System
104
-
105
- * update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
106
-
107
- ### BREAKING CHANGES
91
+ - update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
108
92
 
109
- * enabled multi-outputs (ES6 modules, CJS, UMD)
93
+ ### BREAKING CHANGES
110
94
 
111
- - build scripts now first build ES6 modules in package root, then call
112
- `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
113
- - all imports MUST be updated to only refer to package level
114
- (not individual files anymore). tree shaking in user land will get rid of
115
- all unused imported symbols.
95
+ - enabled multi-outputs (ES6 modules, CJS, UMD)
96
+ - build scripts now first build ES6 modules in package root, then call `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
97
+ - all imports MUST be updated to only refer to package level (not individual files anymore). tree shaking in user land will get rid of all unused imported symbols.
116
98
 
117
- <a name="0.8.0"></a>
118
- # [0.8.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.7.10...@thi.ng/pointfree@0.8.0) (2018-05-13)
99
+ # [0.8.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.7.10...@thi.ng/pointfree@0.8.0) (2018-05-13)
119
100
 
120
- ### Features
101
+ ### Features
121
102
 
122
- * **pointfree:** add execjs for host calls, update readme ([373701b](https://github.com/thi-ng/umbrella/commit/373701b))
103
+ - **pointfree:** add execjs for host calls, update readme ([373701b](https://github.com/thi-ng/umbrella/commit/373701b))
123
104
 
124
- <a name="0.7.9"></a>
125
- ## [0.7.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.7.8...@thi.ng/pointfree@0.7.9) (2018-05-10)
105
+ ## [0.7.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.7.8...@thi.ng/pointfree@0.7.9) (2018-05-10)
126
106
 
127
- ### Bug Fixes
107
+ ### Bug Fixes
128
108
 
129
- * **pointfree:** minor update error handling ([5391d98](https://github.com/thi-ng/umbrella/commit/5391d98))
109
+ - **pointfree:** minor update error handling ([5391d98](https://github.com/thi-ng/umbrella/commit/5391d98))
130
110
 
131
- <a name="0.7.0"></a>
132
- # [0.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.6.2...@thi.ng/pointfree@0.7.0) (2018-04-03)
111
+ # [0.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.6.2...@thi.ng/pointfree@0.7.0) (2018-04-03)
133
112
 
134
- ### Features
113
+ ### Features
135
114
 
136
- * **pointfree:** add copy() word ([68a8dba](https://github.com/thi-ng/umbrella/commit/68a8dba))
137
- * **pointfree:** add math ops, update load/loadkey, update tests ([2101e92](https://github.com/thi-ng/umbrella/commit/2101e92))
115
+ - **pointfree:** add copy() word ([68a8dba](https://github.com/thi-ng/umbrella/commit/68a8dba))
116
+ - **pointfree:** add math ops, update load/loadkey, update tests ([2101e92](https://github.com/thi-ng/umbrella/commit/2101e92))
138
117
 
139
- <a name="0.6.1"></a>
140
- ## [0.6.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.6.0...@thi.ng/pointfree@0.6.1) (2018-03-31)
118
+ ## [0.6.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.6.0...@thi.ng/pointfree@0.6.1) (2018-03-31)
141
119
 
142
- ### Bug Fixes
120
+ ### Bug Fixes
143
121
 
144
- * **pointfree:** reexport ensureStack fns ([a0bf781](https://github.com/thi-ng/umbrella/commit/a0bf781))
122
+ - **pointfree:** reexport ensureStack fns ([a0bf781](https://github.com/thi-ng/umbrella/commit/a0bf781))
145
123
 
146
- <a name="0.6.0"></a>
147
- # [0.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.5.0...@thi.ng/pointfree@0.6.0) (2018-03-31)
124
+ # [0.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.5.0...@thi.ng/pointfree@0.6.0) (2018-03-31)
148
125
 
149
- ### Features
126
+ ### Features
150
127
 
151
- * **pointfree:** add caseq() ([5db90c5](https://github.com/thi-ng/umbrella/commit/5db90c5))
128
+ - **pointfree:** add caseq() ([5db90c5](https://github.com/thi-ng/umbrella/commit/5db90c5))
152
129
 
153
- <a name="0.5.0"></a>
154
- # [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.4.0...@thi.ng/pointfree@0.5.0) (2018-03-29)
130
+ # [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.4.0...@thi.ng/pointfree@0.5.0) (2018-03-29)
155
131
 
156
- ### Features
132
+ ### Features
157
133
 
158
- * **pointfree:** add combinators, update controlflow words, remove execq ([3dc30a8](https://github.com/thi-ng/umbrella/commit/3dc30a8))
159
- * **pointfree:** add more dataflow combinators, words & tests ([b096e43](https://github.com/thi-ng/umbrella/commit/b096e43))
134
+ - **pointfree:** add combinators, update controlflow words, remove execq ([3dc30a8](https://github.com/thi-ng/umbrella/commit/3dc30a8))
135
+ - **pointfree:** add more dataflow combinators, words & tests ([b096e43](https://github.com/thi-ng/umbrella/commit/b096e43))
160
136
 
161
- <a name="0.4.0"></a>
162
- # [0.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.3.0...@thi.ng/pointfree@0.4.0) (2018-03-29)
137
+ # [0.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.3.0...@thi.ng/pointfree@0.4.0) (2018-03-29)
163
138
 
164
- ### Features
139
+ ### Features
165
140
 
166
- * **pointfree:** add new words, constructs, aliases, fix re-exports ([943b4f9](https://github.com/thi-ng/umbrella/commit/943b4f9))
141
+ - **pointfree:** add new words, constructs, aliases, fix re-exports ([943b4f9](https://github.com/thi-ng/umbrella/commit/943b4f9))
167
142
 
168
- <a name="0.3.0"></a>
169
- # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.2.1...@thi.ng/pointfree@0.3.0) (2018-03-28)
143
+ # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.2.1...@thi.ng/pointfree@0.3.0) (2018-03-28)
170
144
 
171
- ### Bug Fixes
145
+ ### Bug Fixes
172
146
 
173
- * **pointfree:** add 0-arity comp() (identity fn) ([10d5a34](https://github.com/thi-ng/umbrella/commit/10d5a34))
174
- * **pointfree:** wordU(), add tests ([1a01f9a](https://github.com/thi-ng/umbrella/commit/1a01f9a))
147
+ - **pointfree:** add 0-arity comp() (identity fn) ([10d5a34](https://github.com/thi-ng/umbrella/commit/10d5a34))
148
+ - **pointfree:** wordU(), add tests ([1a01f9a](https://github.com/thi-ng/umbrella/commit/1a01f9a))
175
149
 
176
- ### Features
150
+ ### Features
177
151
 
178
- * **pointfree:** add new words, rename words, remove mapnth, pushl2 ([0f0c382](https://github.com/thi-ng/umbrella/commit/0f0c382))
179
- * **pointfree:** add rstack, update StackContext ([1c4cd2f](https://github.com/thi-ng/umbrella/commit/1c4cd2f))
180
- * **pointfree:** further restructure, perf, add tests ([3252554](https://github.com/thi-ng/umbrella/commit/3252554))
181
- * **pointfree:** major refactor & restructure ([a48361d](https://github.com/thi-ng/umbrella/commit/a48361d))
182
- * **pointfree:** major update readme, package ([e52b869](https://github.com/thi-ng/umbrella/commit/e52b869))
183
- * **pointfree:** update all words to return stack ([79b4ce3](https://github.com/thi-ng/umbrella/commit/79b4ce3))
184
- * **pointfree:** update word/wordU, add append(), tuple(), join() ([f3f0bec](https://github.com/thi-ng/umbrella/commit/f3f0bec))
152
+ - **pointfree:** add new words, rename words, remove mapnth, pushl2 ([0f0c382](https://github.com/thi-ng/umbrella/commit/0f0c382))
153
+ - **pointfree:** add rstack, update StackContext ([1c4cd2f](https://github.com/thi-ng/umbrella/commit/1c4cd2f))
154
+ - **pointfree:** further restructure, perf, add tests ([3252554](https://github.com/thi-ng/umbrella/commit/3252554))
155
+ - **pointfree:** major refactor & restructure ([a48361d](https://github.com/thi-ng/umbrella/commit/a48361d))
156
+ - **pointfree:** major update readme, package ([e52b869](https://github.com/thi-ng/umbrella/commit/e52b869))
157
+ - **pointfree:** update all words to return stack ([79b4ce3](https://github.com/thi-ng/umbrella/commit/79b4ce3))
158
+ - **pointfree:** update word/wordU, add append(), tuple(), join() ([f3f0bec](https://github.com/thi-ng/umbrella/commit/f3f0bec))
185
159
 
186
- <a name="0.2.1"></a>
187
- ## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.2.0...@thi.ng/pointfree@0.2.1) (2018-03-23)
160
+ ## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.2.0...@thi.ng/pointfree@0.2.1) (2018-03-23)
188
161
 
189
- ### Bug Fixes
162
+ ### Bug Fixes
190
163
 
191
- * **pointfree:** fix readme/docs ([f211c39](https://github.com/thi-ng/umbrella/commit/f211c39))
164
+ - **pointfree:** fix readme/docs ([f211c39](https://github.com/thi-ng/umbrella/commit/f211c39))
192
165
 
193
- <a name="0.2.0"></a>
194
- # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.1.0...@thi.ng/pointfree@0.2.0) (2018-03-23)
166
+ # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.1.0...@thi.ng/pointfree@0.2.0) (2018-03-23)
195
167
 
196
- ### Features
168
+ ### Features
197
169
 
198
- * **pointfree:** add unwrap, quatations, math/bitops, array/obj access ([f75486d](https://github.com/thi-ng/umbrella/commit/f75486d))
199
- * **pointfree:** support data vals in program, add collect(), update readme ([6cac0c7](https://github.com/thi-ng/umbrella/commit/6cac0c7))
170
+ - **pointfree:** add unwrap, quatations, math/bitops, array/obj access ([f75486d](https://github.com/thi-ng/umbrella/commit/f75486d))
171
+ - **pointfree:** support data vals in program, add collect(), update readme ([6cac0c7](https://github.com/thi-ng/umbrella/commit/6cac0c7))
package/README.md CHANGED
@@ -198,15 +198,24 @@ non-linear control flow.
198
198
  yarn add @thi.ng/pointfree
199
199
  ```
200
200
 
201
+ ES module import:
202
+
201
203
  ```html
202
- // ES module
203
- <script type="module" src="https://unpkg.com/@thi.ng/pointfree?module" crossorigin></script>
204
+ <script type="module" src="https://cdn.skypack.dev/@thi.ng/pointfree"></script>
205
+ ```
206
+
207
+ [Skypack documentation](https://docs.skypack.dev/)
208
+
209
+ For Node.js REPL:
210
+
211
+ ```text
212
+ # with flag only for < v16
213
+ node --experimental-repl-await
204
214
 
205
- // UMD
206
- <script src="https://unpkg.com/@thi.ng/pointfree/lib/index.umd.js" crossorigin></script>
215
+ > const pointfree = await import("@thi.ng/pointfree");
207
216
  ```
208
217
 
209
- Package sizes (gzipped, pre-treeshake): ESM: 3.32 KB / CJS: 3.86 KB / UMD: 3.58 KB
218
+ Package sizes (gzipped, pre-treeshake): ESM: 3.33 KB
210
219
 
211
220
  ## Dependencies
212
221
 
@@ -224,10 +233,9 @@ directory are using this package.
224
233
 
225
234
  A selection:
226
235
 
227
- | Screenshot | Description | Live| Source |
228
- | | | demo| |
229
- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------- | --- | -------------------------------------------------------------------------------- |
230
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/pointfree-svg.png" width="240"/> | Generate SVG using pointfree DSL | | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/pointfree-svg) |
236
+ | Screenshot | Description | Live demo | Source |
237
+ |:---------------------------------------------------------------------------------------------------------------------|:---------------------------------|:----------|:---------------------------------------------------------------------------------|
238
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/pointfree-svg.png" width="240"/> | Generate SVG using pointfree DSL | | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/pointfree-svg) |
231
239
 
232
240
  ## API
233
241
 
package/array.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { StackContext, StackFn } from "./api";
1
+ import type { StackContext, StackFn } from "./api.js";
2
2
  /**
3
3
  * Pushes a new empty array on the d-stack. While it's easily possible to
4
4
  * use `[]` as part of a stack program, the `list` word is intended to
package/array.js CHANGED
@@ -1,9 +1,11 @@
1
- import { isArray, isPlainObject } from "@thi.ng/checks";
2
- import { illegalArgs, illegalState } from "@thi.ng/errors";
3
- import { defOp1, defOp2, defOp2v } from "./ops";
4
- import { $, $n } from "./safe";
5
- import { invrot, swap } from "./stack";
6
- import { $stackFn, defWord } from "./word";
1
+ import { isArray } from "@thi.ng/checks/is-array";
2
+ import { isPlainObject } from "@thi.ng/checks/is-plain-object";
3
+ import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
4
+ import { illegalState } from "@thi.ng/errors/illegal-state";
5
+ import { defOp1, defOp2, defOp2v } from "./ops.js";
6
+ import { $, $n } from "./safe.js";
7
+ import { invrot, swap } from "./stack.js";
8
+ import { $stackFn, defWord } from "./word.js";
7
9
  //////////////////// Array / list ops ////////////////////
8
10
  /**
9
11
  * Pushes a new empty array on the d-stack. While it's easily possible to
@@ -318,7 +320,8 @@ export const length = defOp1((x) => x.length);
318
320
  export const copy = defOp1((x) => isArray(x)
319
321
  ? x.slice()
320
322
  : isPlainObject(x)
321
- ? Object.assign({}, x) : illegalArgs(`can't copy type ${typeof x}`));
323
+ ? { ...x }
324
+ : illegalArgs(`can't copy type ${typeof x}`));
322
325
  /**
323
326
  * Reads key/index from object/array.
324
327
  *
package/binary.d.ts CHANGED
@@ -3,41 +3,41 @@
3
3
  *
4
4
  * @param ctx -
5
5
  */
6
- export declare const bitand: (ctx: import("./api").StackContext) => import("./api").StackContext;
6
+ export declare const bitand: (ctx: import("./api.js").StackContext) => import("./api.js").StackContext;
7
7
  /**
8
8
  * ( x y -- x|y )
9
9
  *
10
10
  * @param ctx -
11
11
  */
12
- export declare const bitor: (ctx: import("./api").StackContext) => import("./api").StackContext;
12
+ export declare const bitor: (ctx: import("./api.js").StackContext) => import("./api.js").StackContext;
13
13
  /**
14
14
  * ( x y -- x^y )
15
15
  *
16
16
  * @param ctx -
17
17
  */
18
- export declare const bitxor: (ctx: import("./api").StackContext) => import("./api").StackContext;
18
+ export declare const bitxor: (ctx: import("./api.js").StackContext) => import("./api.js").StackContext;
19
19
  /**
20
20
  * ( x -- ~x )
21
21
  *
22
22
  * @param ctx -
23
23
  */
24
- export declare const bitnot: (ctx: import("./api").StackContext) => import("./api").StackContext;
24
+ export declare const bitnot: (ctx: import("./api.js").StackContext) => import("./api.js").StackContext;
25
25
  /**
26
26
  * ( x y -- x<<y )
27
27
  *
28
28
  * @param ctx -
29
29
  */
30
- export declare const lsl: (ctx: import("./api").StackContext) => import("./api").StackContext;
30
+ export declare const lsl: (ctx: import("./api.js").StackContext) => import("./api.js").StackContext;
31
31
  /**
32
32
  * ( x y -- x>>y )
33
33
  *
34
34
  * @param ctx -
35
35
  */
36
- export declare const lsr: (ctx: import("./api").StackContext) => import("./api").StackContext;
36
+ export declare const lsr: (ctx: import("./api.js").StackContext) => import("./api.js").StackContext;
37
37
  /**
38
38
  * ( x y -- x>>>y )
39
39
  *
40
40
  * @param ctx -
41
41
  */
42
- export declare const lsru: (ctx: import("./api").StackContext) => import("./api").StackContext;
42
+ export declare const lsru: (ctx: import("./api.js").StackContext) => import("./api.js").StackContext;
43
43
  //# sourceMappingURL=binary.d.ts.map
package/binary.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defOp1, defOp2 } from "./ops";
1
+ import { defOp1, defOp2 } from "./ops.js";
2
2
  //////////////////// Binary ops ////////////////////
3
3
  /**
4
4
  * ( x y -- x&y )
package/cond.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { IObjectOf } from "@thi.ng/api";
2
- import type { StackContext, StackProc } from "./api";
2
+ import type { StackContext, StackProc } from "./api.js";
3
3
  /**
4
4
  * Higher order word. Takes two stack programs: truthy and falsey
5
5
  * branches, respectively. When executed, pops TOS and runs only one of
package/cond.js CHANGED
@@ -1,7 +1,7 @@
1
- import { illegalState } from "@thi.ng/errors";
2
- import { $ } from "./safe";
3
- import { nop } from "./stack";
4
- import { $stackFn } from "./word";
1
+ import { illegalState } from "@thi.ng/errors/illegal-state";
2
+ import { $ } from "./safe.js";
3
+ import { nop } from "./stack.js";
4
+ import { $stackFn } from "./word.js";
5
5
  //////////////////// Conditionals ////////////////////
6
6
  /**
7
7
  * Higher order word. Takes two stack programs: truthy and falsey
@@ -16,7 +16,10 @@ import { $stackFn } from "./word";
16
16
  * @param _then -
17
17
  * @param _else -
18
18
  */
19
- export const defCond = (_then, _else = nop) => (ctx) => ($(ctx[0], 1), $stackFn(ctx[0].pop() ? _then : _else)(ctx));
19
+ export const defCond = (_then, _else = nop) => (ctx) => {
20
+ $(ctx[0], 1);
21
+ return $stackFn(ctx[0].pop() ? _then : _else)(ctx);
22
+ };
20
23
  /**
21
24
  * Non-HOF version of {@link cond}, expects `test` result and both branches on
22
25
  * d-stack. Executes `thenq` word/quotation if `test` is truthy, else
package/context.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Stack, StackContext, StackEnv } from "./api";
1
+ import type { Stack, StackContext, StackEnv } from "./api.js";
2
2
  /**
3
3
  * Creates a new StackContext tuple from given d-stack and/or
4
4
  * environment only (the r-stack is always initialized empty).
package/dataflow.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { StackContext } from "./api";
1
+ import type { StackContext } from "./api.js";
2
2
  /**
3
3
  * Removes `x` from d-stack, calls `q` and restores `x` to the top of
4
4
  * the d-stack after quotation is finished.
@@ -17,131 +17,131 @@ export declare const dip: (ctx: StackContext) => StackContext;
17
17
  *
18
18
  * ( x y q -- x y )
19
19
  */
20
- export declare const dip2: import("./api").StackFn;
20
+ export declare const dip2: import("./api.js").StackFn;
21
21
  /**
22
22
  * Removes `x y z` from d-stack, calls `q` and restores removed
23
23
  * vals to the top of the d-stack after quotation is finished.
24
24
  *
25
25
  * ( x y z q -- x y z )
26
26
  */
27
- export declare const dip3: import("./api").StackFn;
27
+ export declare const dip3: import("./api.js").StackFn;
28
28
  /**
29
29
  * Removes `x y z w` from d-stack, calls `q` and restores removed
30
30
  * vals to the top of the d-stack after quotation is finished.
31
31
  *
32
32
  * ( x y z w q -- x y z w )
33
33
  */
34
- export declare const dip4: import("./api").StackFn;
34
+ export declare const dip4: import("./api.js").StackFn;
35
35
  /**
36
36
  * Calls a quotation with a value on the d-stack, restoring the value
37
37
  * after quotation finished.
38
38
  *
39
39
  * ( x q -- .. x )
40
40
  */
41
- export declare const keep: import("./api").StackFn;
41
+ export declare const keep: import("./api.js").StackFn;
42
42
  /**
43
43
  * Call a quotation with two values on the stack, restoring the values
44
44
  * after quotation finished.
45
45
  *
46
46
  * ( x y q -- .. x y )
47
47
  */
48
- export declare const keep2: import("./api").StackFn;
48
+ export declare const keep2: import("./api.js").StackFn;
49
49
  /**
50
50
  * Call a quotation with three values on the stack, restoring the values
51
51
  * after quotation finished.
52
52
  *
53
53
  * ( x y z q -- .. x y z )
54
54
  */
55
- export declare const keep3: import("./api").StackFn;
55
+ export declare const keep3: import("./api.js").StackFn;
56
56
  /**
57
57
  * First applies `p` to the value `x`, then applies `q` to the same
58
58
  * value.
59
59
  *
60
60
  * ( x p q -- px qx )
61
61
  */
62
- export declare const bi: import("./api").StackFn;
62
+ export declare const bi: import("./api.js").StackFn;
63
63
  /**
64
64
  * First applies `p` to the two input values `x y`, then applies `q` to
65
65
  * the same values.
66
66
  *
67
67
  * ( x y p q -- pxy qxy )
68
68
  */
69
- export declare const bi2: import("./api").StackFn;
69
+ export declare const bi2: import("./api.js").StackFn;
70
70
  /**
71
71
  * First applies `p` to the three input values `x y z`, then applies `q`
72
72
  * to the same values.
73
73
  *
74
74
  * ( x y z p q -- pxyz qxyz )
75
75
  */
76
- export declare const bi3: import("./api").StackFn;
76
+ export declare const bi3: import("./api.js").StackFn;
77
77
  /**
78
78
  * Applies `p` to `x`, then `q` to `x`, and finally `r` to `x`
79
79
  *
80
80
  * ( x p q r -- px qx rx )
81
81
  */
82
- export declare const tri: import("./api").StackFn;
82
+ export declare const tri: import("./api.js").StackFn;
83
83
  /**
84
84
  * Applies `p` to the two input values `x y`, then same with `q`, and
85
85
  * finally with `r`.
86
86
  *
87
87
  * ( x y p q r -- pxy qxy rxy )
88
88
  */
89
- export declare const tri2: import("./api").StackFn;
89
+ export declare const tri2: import("./api.js").StackFn;
90
90
  /**
91
91
  * Applies `p` to the three input values `x y z`, then same with `q`,
92
92
  * and finally with `r`.
93
93
  *
94
94
  * ( x y z p q r -- pxyz qxyz rxyz )
95
95
  */
96
- export declare const tri3: import("./api").StackFn;
96
+ export declare const tri3: import("./api.js").StackFn;
97
97
  /**
98
98
  * Applies `p` to `x`, then applies `q` to `y`.
99
99
  *
100
100
  * ( x y p q -- px qy )
101
101
  */
102
- export declare const bis: import("./api").StackFn;
102
+ export declare const bis: import("./api.js").StackFn;
103
103
  /**
104
104
  * Applies `p` to `a b`, then applies `q` to `c d`.
105
105
  *
106
106
  * ( a b c d p q -- pab qcd )
107
107
  */
108
- export declare const bis2: import("./api").StackFn;
108
+ export declare const bis2: import("./api.js").StackFn;
109
109
  /**
110
110
  * Applies `p` to `x`, then `q` to `y`, and finally `r` to `z`.
111
111
  *
112
112
  * ( x y z p q r -- )
113
113
  */
114
- export declare const tris: import("./api").StackFn;
114
+ export declare const tris: import("./api.js").StackFn;
115
115
  /**
116
116
  * Applies `p` to `u v`, then `q` to `w x`, and finally `r` to `y z`.
117
117
  *
118
118
  * ( u v w x y z p q r -- puv qwx ryz )
119
119
  */
120
- export declare const tris2: import("./api").StackFn;
120
+ export declare const tris2: import("./api.js").StackFn;
121
121
  /**
122
122
  * Applies the quotation `q` to `x`, then to `y`.
123
123
  *
124
124
  * ( x y q -- qx qy )
125
125
  */
126
- export declare const bia: import("./api").StackFn;
126
+ export declare const bia: import("./api.js").StackFn;
127
127
  /**
128
128
  * Applies the quotation `q` to `x y`, then to `z w`.
129
129
  *
130
130
  * ( x y z w q -- qxy qzw )
131
131
  */
132
- export declare const bia2: import("./api").StackFn;
132
+ export declare const bia2: import("./api.js").StackFn;
133
133
  /**
134
134
  * Applies the `q` to `x`, then to `y`, and finally to `z`.
135
135
  *
136
136
  * ( x y z q -- qx qy qz )
137
137
  */
138
- export declare const tria: import("./api").StackFn;
138
+ export declare const tria: import("./api.js").StackFn;
139
139
  /**
140
140
  * Applies the quotation to `u v`, then to `w x`, and then to `y z`.
141
141
  *
142
142
  * ( u v w x y z q -- quv qwx qyz )
143
143
  */
144
- export declare const tria2: import("./api").StackFn;
144
+ export declare const tria2: import("./api.js").StackFn;
145
145
  /**
146
146
  * Applies `q` individually to both input vals `x y` and combines
147
147
  * results with `and`. The final result will be true if both interim
@@ -149,7 +149,7 @@ export declare const tria2: import("./api").StackFn;
149
149
  *
150
150
  * ( x y q -- qx && qy )
151
151
  */
152
- export declare const both: import("./api").StackFn;
152
+ export declare const both: import("./api.js").StackFn;
153
153
  /**
154
154
  * Applies `q` individually to both input vals `x y` and combines results with `or`.
155
155
  * The final result will be true if at least one of the interim results
@@ -157,5 +157,5 @@ export declare const both: import("./api").StackFn;
157
157
  *
158
158
  * ( x y q -- qx || qy )
159
159
  */
160
- export declare const either: import("./api").StackFn;
160
+ export declare const either: import("./api.js").StackFn;
161
161
  //# sourceMappingURL=dataflow.d.ts.map