@thi.ng/pointfree 3.1.82 → 3.1.83
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 +7 -1
- package/README.md +1 -1
- package/ops.js +4 -4
- package/package.json +11 -11
- package/word.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-21T19:34:38Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [3.1.83](https://github.com/thi-ng/umbrella/tree/@thi.ng/pointfree@3.1.83) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
|
|
17
|
+
|
|
12
18
|
### [3.1.50](https://github.com/thi-ng/umbrella/tree/@thi.ng/pointfree@3.1.50) (2023-11-09)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/ops.js
CHANGED
|
@@ -25,24 +25,24 @@ const defOp2v = (f) => (ctx) => {
|
|
|
25
25
|
const a = stack[n];
|
|
26
26
|
const isa = isArray(a);
|
|
27
27
|
const isb = isArray(b);
|
|
28
|
-
stack[n] = isa && isb ?
|
|
28
|
+
stack[n] = isa && isb ? __op2vAB(f, a, b) : isb && !isa ? __op2vB(f, a, b) : isa && !isb ? __op2vA(f, a, b) : illegalArgs("at least one arg must be an array");
|
|
29
29
|
return ctx;
|
|
30
30
|
};
|
|
31
|
-
const
|
|
31
|
+
const __op2vAB = (f, a, b) => {
|
|
32
32
|
const res = new Array(Math.min(a.length, b.length));
|
|
33
33
|
for (let i = res.length - 1; i >= 0; i--) {
|
|
34
34
|
res[i] = f(b[i], a[i]);
|
|
35
35
|
}
|
|
36
36
|
return res;
|
|
37
37
|
};
|
|
38
|
-
const
|
|
38
|
+
const __op2vA = (f, a, b) => {
|
|
39
39
|
const res = new Array(a.length);
|
|
40
40
|
for (let i = res.length - 1; i >= 0; i--) {
|
|
41
41
|
res[i] = f(b, a[i]);
|
|
42
42
|
}
|
|
43
43
|
return res;
|
|
44
44
|
};
|
|
45
|
-
const
|
|
45
|
+
const __op2vB = (f, a, b) => {
|
|
46
46
|
const res = new Array(b.length);
|
|
47
47
|
for (let i = res.length - 1; i >= 0; i--) {
|
|
48
48
|
res[i] = f(b[i], a);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/pointfree",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.83",
|
|
4
4
|
"description": "Pointfree functional composition / Forth style stack execution engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://thi.ng/pointfree",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/checks": "^3.6.
|
|
41
|
-
"@thi.ng/compose": "^3.0.
|
|
42
|
-
"@thi.ng/equiv": "^2.1.
|
|
43
|
-
"@thi.ng/errors": "^2.5.
|
|
39
|
+
"@thi.ng/api": "^8.11.3",
|
|
40
|
+
"@thi.ng/checks": "^3.6.5",
|
|
41
|
+
"@thi.ng/compose": "^3.0.5",
|
|
42
|
+
"@thi.ng/equiv": "^2.1.59",
|
|
43
|
+
"@thi.ng/errors": "^2.5.8"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@microsoft/api-extractor": "^7.
|
|
47
|
-
"esbuild": "^0.21.
|
|
46
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
47
|
+
"esbuild": "^0.21.5",
|
|
48
48
|
"typedoc": "^0.25.13",
|
|
49
|
-
"typescript": "^5.
|
|
49
|
+
"typescript": "^5.5.2"
|
|
50
50
|
},
|
|
51
51
|
"keywords": [
|
|
52
52
|
"binary",
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
"alias": "pf",
|
|
134
134
|
"year": 2015
|
|
135
135
|
},
|
|
136
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
|
|
137
137
|
}
|
package/word.js
CHANGED
|
@@ -4,7 +4,7 @@ import { compL } from "@thi.ng/compose/comp";
|
|
|
4
4
|
import { $ } from "./safe.js";
|
|
5
5
|
import { tos } from "./stack.js";
|
|
6
6
|
const $stackFn = (f) => isArray(f) ? defWord(f) : f;
|
|
7
|
-
const
|
|
7
|
+
const __compile = (prog) => prog.length > 0 ? compL.apply(
|
|
8
8
|
null,
|
|
9
9
|
prog.map(
|
|
10
10
|
(w) => !isFunction(w) ? (ctx) => (ctx[0].push(w), ctx) : w
|
|
@@ -12,11 +12,11 @@ const compile = (prog) => prog.length > 0 ? compL.apply(
|
|
|
12
12
|
) : (ctx) => ctx;
|
|
13
13
|
const unwrap = ([stack], n = 1) => n === 1 ? tos(stack) : stack.slice(Math.max(0, stack.length - n));
|
|
14
14
|
const defWord = (prog, env, mergeEnv = true) => {
|
|
15
|
-
const w =
|
|
15
|
+
const w = __compile(prog);
|
|
16
16
|
return env ? mergeEnv ? (ctx) => (w([ctx[0], ctx[1], { ...ctx[2], ...env }]), ctx) : (ctx) => (w([ctx[0], ctx[1], { ...env }]), ctx) : w;
|
|
17
17
|
};
|
|
18
18
|
const defWordU = (prog, n = 1, env, mergeEnv = true) => {
|
|
19
|
-
const w =
|
|
19
|
+
const w = __compile(prog);
|
|
20
20
|
return env ? mergeEnv ? (ctx) => unwrap(w([ctx[0], ctx[1], { ...ctx[2], ...env }]), n) : (ctx) => unwrap(w([ctx[0], ctx[1], { ...env }]), n) : (ctx) => unwrap(w(ctx), n);
|
|
21
21
|
};
|
|
22
22
|
const exec = (ctx) => ($(ctx[0], 1), $stackFn(ctx[0].pop())(ctx));
|