@thi.ng/pointfree 2.0.36 → 3.0.3
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 +101 -81
- package/README.md +14 -5
- package/array.d.ts +1 -1
- package/array.js +10 -7
- package/binary.d.ts +7 -7
- package/binary.js +1 -1
- package/cond.d.ts +1 -1
- package/cond.js +8 -5
- package/context.d.ts +1 -1
- package/dataflow.d.ts +23 -23
- package/dataflow.js +4 -4
- package/env.d.ts +1 -1
- package/env.js +7 -3
- package/index.d.ts +18 -18
- package/index.js +18 -18
- package/io.d.ts +1 -1
- package/io.js +1 -1
- package/logic.d.ts +14 -14
- package/logic.js +1 -1
- package/loop.d.ts +1 -1
- package/loop.js +2 -2
- package/math.d.ts +2 -2
- package/math.js +3 -3
- package/ops.d.ts +1 -1
- package/ops.js +3 -3
- package/package.json +82 -26
- package/run.d.ts +1 -1
- package/run.js +3 -2
- package/safe.d.ts +2 -2
- package/safe.js +2 -2
- package/stack.d.ts +1 -1
- package/stack.js +1 -1
- package/string.d.ts +1 -1
- package/string.js +1 -1
- package/word.d.ts +1 -1
- package/word.js +9 -8
- package/lib/index.js +0 -785
- package/lib/index.js.map +0 -1
- package/lib/index.umd.js +0 -1
- package/lib/index.umd.js.map +0 -1
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
|
-
## [
|
|
6
|
+
## [3.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@3.0.2...@thi.ng/pointfree@3.0.3) (2021-10-15)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @thi.ng/pointfree
|
|
9
9
|
|
|
@@ -11,149 +11,169 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## [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)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @thi.ng/pointfree
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [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)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @thi.ng/pointfree
|
|
25
|
+
|
|
15
26
|
|
|
16
27
|
|
|
17
|
-
### Features
|
|
18
28
|
|
|
19
|
-
|
|
29
|
+
|
|
30
|
+
# [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)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Build System
|
|
34
|
+
|
|
35
|
+
* major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
|
|
20
36
|
|
|
21
37
|
|
|
22
38
|
### BREAKING CHANGES
|
|
23
39
|
|
|
24
|
-
*
|
|
40
|
+
* discontinue CommonJS & UMD versions
|
|
25
41
|
|
|
42
|
+
- only ESM modules will be published from now on
|
|
43
|
+
- CJS obsolete due to ESM support in recent versions of node:
|
|
44
|
+
- i.e. launch NodeJS via:
|
|
45
|
+
- `node --experimental-specifier-resolution=node --experimental-repl-await`
|
|
46
|
+
- in the node REPL use `await import(...)` instead of `require()`
|
|
47
|
+
- UMD obsolete due to widespread browser support for ESM
|
|
26
48
|
|
|
49
|
+
Also:
|
|
50
|
+
- normalize/restructure/reorg all package.json files
|
|
51
|
+
- cleanup all build scripts, remove obsolete
|
|
52
|
+
- switch from mocha to @thi.ng/testament for all tests
|
|
27
53
|
|
|
28
54
|
|
|
29
55
|
|
|
30
|
-
# [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)
|
|
31
56
|
|
|
32
57
|
|
|
33
|
-
### Features
|
|
34
58
|
|
|
35
|
-
|
|
36
|
-
* **pointfree:** add tojson()/fromjson() conversion ops ([829f3ab](https://github.com/thi-ng/umbrella/commit/829f3ab129084619c05b434732b46b6c26d32b5e))
|
|
37
|
-
* **pointfree:** add whenq(), ismatch() ([44ab1d7](https://github.com/thi-ng/umbrella/commit/44ab1d7f5ff52a9226b873b42adada3eac1674e9))
|
|
59
|
+
# [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)
|
|
38
60
|
|
|
61
|
+
### Features
|
|
39
62
|
|
|
63
|
+
- **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)
|
|
40
64
|
|
|
65
|
+
### BREAKING CHANGES
|
|
41
66
|
|
|
67
|
+
- **pointfree:** rename HOF words
|
|
42
68
|
|
|
43
|
-
#
|
|
69
|
+
# [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)
|
|
44
70
|
|
|
45
|
-
###
|
|
71
|
+
### Features
|
|
46
72
|
|
|
47
|
-
|
|
73
|
+
- **pointfree:** add $try word, update compile() to allow empty quotations ([41de106](https://github.com/thi-ng/umbrella/commit/41de106e776ad102e827ccc062a19a4e637613a0))
|
|
74
|
+
- **pointfree:** add tojson()/fromjson() conversion ops ([829f3ab](https://github.com/thi-ng/umbrella/commit/829f3ab129084619c05b434732b46b6c26d32b5e))
|
|
75
|
+
- **pointfree:** add whenq(), ismatch() ([44ab1d7](https://github.com/thi-ng/umbrella/commit/44ab1d7f5ff52a9226b873b42adada3eac1674e9))
|
|
48
76
|
|
|
49
|
-
#
|
|
77
|
+
# [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)
|
|
50
78
|
|
|
51
|
-
###
|
|
79
|
+
### Features
|
|
52
80
|
|
|
53
|
-
|
|
81
|
+
- **pointfree:** add new r-stack words, refactor ([dbad162](https://github.com/thi-ng/umbrella/commit/dbad162))
|
|
54
82
|
|
|
55
|
-
|
|
83
|
+
# [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)
|
|
56
84
|
|
|
57
|
-
###
|
|
85
|
+
### Features
|
|
58
86
|
|
|
59
|
-
|
|
87
|
+
- **pointfree:** enable TS strict compiler flags (refactor) ([1f9d155](https://github.com/thi-ng/umbrella/commit/1f9d155))
|
|
60
88
|
|
|
61
|
-
|
|
89
|
+
## [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)
|
|
62
90
|
|
|
63
|
-
###
|
|
91
|
+
### Bug Fixes
|
|
64
92
|
|
|
65
|
-
|
|
93
|
+
- **pointfree:** update safeMode handling ([d27bcba](https://github.com/thi-ng/umbrella/commit/d27bcba))
|
|
66
94
|
|
|
67
|
-
|
|
95
|
+
# [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)
|
|
96
|
+
|
|
97
|
+
### Build System
|
|
98
|
+
|
|
99
|
+
- update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
|
|
68
100
|
|
|
69
|
-
|
|
101
|
+
### BREAKING CHANGES
|
|
70
102
|
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
- all imports MUST be updated to only refer to package level
|
|
74
|
-
(not individual files anymore). tree shaking in user land will get rid of
|
|
75
|
-
all unused imported symbols.
|
|
103
|
+
- enabled multi-outputs (ES6 modules, CJS, UMD)
|
|
104
|
+
- build scripts now first build ES6 modules in package root, then call `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
|
|
105
|
+
- 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.
|
|
76
106
|
|
|
77
|
-
|
|
78
|
-
# [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)
|
|
107
|
+
# [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)
|
|
79
108
|
|
|
80
|
-
###
|
|
109
|
+
### Features
|
|
81
110
|
|
|
82
|
-
|
|
111
|
+
- **pointfree:** add execjs for host calls, update readme ([373701b](https://github.com/thi-ng/umbrella/commit/373701b))
|
|
83
112
|
|
|
84
|
-
|
|
85
|
-
## [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)
|
|
113
|
+
## [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)
|
|
86
114
|
|
|
87
|
-
###
|
|
115
|
+
### Bug Fixes
|
|
88
116
|
|
|
89
|
-
|
|
117
|
+
- **pointfree:** minor update error handling ([5391d98](https://github.com/thi-ng/umbrella/commit/5391d98))
|
|
90
118
|
|
|
91
|
-
|
|
92
|
-
# [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)
|
|
119
|
+
# [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)
|
|
93
120
|
|
|
94
|
-
###
|
|
121
|
+
### Features
|
|
95
122
|
|
|
96
|
-
|
|
97
|
-
|
|
123
|
+
- **pointfree:** add copy() word ([68a8dba](https://github.com/thi-ng/umbrella/commit/68a8dba))
|
|
124
|
+
- **pointfree:** add math ops, update load/loadkey, update tests ([2101e92](https://github.com/thi-ng/umbrella/commit/2101e92))
|
|
98
125
|
|
|
99
|
-
|
|
100
|
-
## [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)
|
|
126
|
+
## [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)
|
|
101
127
|
|
|
102
|
-
###
|
|
128
|
+
### Bug Fixes
|
|
103
129
|
|
|
104
|
-
|
|
130
|
+
- **pointfree:** reexport ensureStack fns ([a0bf781](https://github.com/thi-ng/umbrella/commit/a0bf781))
|
|
105
131
|
|
|
106
|
-
|
|
107
|
-
# [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)
|
|
132
|
+
# [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)
|
|
108
133
|
|
|
109
|
-
###
|
|
134
|
+
### Features
|
|
110
135
|
|
|
111
|
-
|
|
136
|
+
- **pointfree:** add caseq() ([5db90c5](https://github.com/thi-ng/umbrella/commit/5db90c5))
|
|
112
137
|
|
|
113
|
-
|
|
114
|
-
# [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)
|
|
138
|
+
# [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)
|
|
115
139
|
|
|
116
|
-
###
|
|
140
|
+
### Features
|
|
117
141
|
|
|
118
|
-
|
|
119
|
-
|
|
142
|
+
- **pointfree:** add combinators, update controlflow words, remove execq ([3dc30a8](https://github.com/thi-ng/umbrella/commit/3dc30a8))
|
|
143
|
+
- **pointfree:** add more dataflow combinators, words & tests ([b096e43](https://github.com/thi-ng/umbrella/commit/b096e43))
|
|
120
144
|
|
|
121
|
-
|
|
122
|
-
# [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)
|
|
145
|
+
# [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)
|
|
123
146
|
|
|
124
|
-
###
|
|
147
|
+
### Features
|
|
125
148
|
|
|
126
|
-
|
|
149
|
+
- **pointfree:** add new words, constructs, aliases, fix re-exports ([943b4f9](https://github.com/thi-ng/umbrella/commit/943b4f9))
|
|
127
150
|
|
|
128
|
-
|
|
129
|
-
# [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)
|
|
151
|
+
# [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)
|
|
130
152
|
|
|
131
|
-
###
|
|
153
|
+
### Bug Fixes
|
|
132
154
|
|
|
133
|
-
|
|
134
|
-
|
|
155
|
+
- **pointfree:** add 0-arity comp() (identity fn) ([10d5a34](https://github.com/thi-ng/umbrella/commit/10d5a34))
|
|
156
|
+
- **pointfree:** wordU(), add tests ([1a01f9a](https://github.com/thi-ng/umbrella/commit/1a01f9a))
|
|
135
157
|
|
|
136
|
-
###
|
|
158
|
+
### Features
|
|
137
159
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
160
|
+
- **pointfree:** add new words, rename words, remove mapnth, pushl2 ([0f0c382](https://github.com/thi-ng/umbrella/commit/0f0c382))
|
|
161
|
+
- **pointfree:** add rstack, update StackContext ([1c4cd2f](https://github.com/thi-ng/umbrella/commit/1c4cd2f))
|
|
162
|
+
- **pointfree:** further restructure, perf, add tests ([3252554](https://github.com/thi-ng/umbrella/commit/3252554))
|
|
163
|
+
- **pointfree:** major refactor & restructure ([a48361d](https://github.com/thi-ng/umbrella/commit/a48361d))
|
|
164
|
+
- **pointfree:** major update readme, package ([e52b869](https://github.com/thi-ng/umbrella/commit/e52b869))
|
|
165
|
+
- **pointfree:** update all words to return stack ([79b4ce3](https://github.com/thi-ng/umbrella/commit/79b4ce3))
|
|
166
|
+
- **pointfree:** update word/wordU, add append(), tuple(), join() ([f3f0bec](https://github.com/thi-ng/umbrella/commit/f3f0bec))
|
|
145
167
|
|
|
146
|
-
|
|
147
|
-
## [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)
|
|
168
|
+
## [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)
|
|
148
169
|
|
|
149
|
-
###
|
|
170
|
+
### Bug Fixes
|
|
150
171
|
|
|
151
|
-
|
|
172
|
+
- **pointfree:** fix readme/docs ([f211c39](https://github.com/thi-ng/umbrella/commit/f211c39))
|
|
152
173
|
|
|
153
|
-
|
|
154
|
-
# [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)
|
|
174
|
+
# [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)
|
|
155
175
|
|
|
156
|
-
###
|
|
176
|
+
### Features
|
|
157
177
|
|
|
158
|
-
|
|
159
|
-
|
|
178
|
+
- **pointfree:** add unwrap, quatations, math/bitops, array/obj access ([f75486d](https://github.com/thi-ng/umbrella/commit/f75486d))
|
|
179
|
+
- **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
|
-
|
|
203
|
-
|
|
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
|
-
|
|
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.
|
|
218
|
+
Package sizes (gzipped, pre-treeshake): ESM: 3.33 KB
|
|
210
219
|
|
|
211
220
|
## Dependencies
|
|
212
221
|
|
package/array.d.ts
CHANGED
package/array.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { isArray
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { $
|
|
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
|
-
?
|
|
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
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) =>
|
|
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
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
|
package/dataflow.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { and, or } from "./logic";
|
|
2
|
-
import { $ } from "./safe";
|
|
3
|
-
import { dup, dup2, dup3, over, swap } from "./stack";
|
|
4
|
-
import { $stackFn, defWord, exec } from "./word";
|
|
1
|
+
import { and, or } from "./logic.js";
|
|
2
|
+
import { $ } from "./safe.js";
|
|
3
|
+
import { dup, dup2, dup3, over, swap } from "./stack.js";
|
|
4
|
+
import { $stackFn, defWord, exec } from "./word.js";
|
|
5
5
|
//////////////////// Dataflow combinators ////////////////////
|
|
6
6
|
// these combinators have been ported from Factor:
|
|
7
7
|
// http://docs.factorcode.org:8080/content/article-dataflow-combinators.html
|
package/env.d.ts
CHANGED
package/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { illegalArgs } from "@thi.ng/errors";
|
|
2
|
-
import { $ } from "./safe";
|
|
1
|
+
import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
|
|
2
|
+
import { $ } from "./safe.js";
|
|
3
3
|
//////////////////// Environment ////////////////////
|
|
4
4
|
/**
|
|
5
5
|
* Pushes current env onto d-stack.
|
|
@@ -61,4 +61,8 @@ export const defLoadKey = (key) => (ctx) => {
|
|
|
61
61
|
* @param ctx -
|
|
62
62
|
* @param env -
|
|
63
63
|
*/
|
|
64
|
-
export const defStoreKey = (key) => (ctx) =>
|
|
64
|
+
export const defStoreKey = (key) => (ctx) => {
|
|
65
|
+
$(ctx[0], 1);
|
|
66
|
+
ctx[2][key] = ctx[0].pop();
|
|
67
|
+
return ctx;
|
|
68
|
+
};
|