hclang 0.23.0 → 0.23.1
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/esm/lib/bundle/hc-sources.js +19 -6
- package/esm/lib/ops/iterators.js +13 -4
- package/esm/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -449,6 +449,25 @@ export const HC_SOURCES = new Map([
|
|
|
449
449
|
"; [1, 2, 4] | 1",
|
|
450
450
|
"# 8",
|
|
451
451
|
"```",
|
|
452
|
+
"## A map keeps its answers apart, from a literal too",
|
|
453
|
+
"",
|
|
454
|
+
"**Decision.** A map never accumulates into its receiver (#417). Each element is",
|
|
455
|
+
"applied to the receiver's collecting copy, a fresh aggregate holding the same",
|
|
456
|
+
"members, as applying through an immutable name already does. A reduce may",
|
|
457
|
+
"write its fresh accumulator in place, since only the final answer escapes, but",
|
|
458
|
+
"a map answers once per element. Before v0.23.1 an aggregate that no name held",
|
|
459
|
+
"collected every element and was answered each time, so `[1, 2] & [0]` was one",
|
|
460
|
+
"array `[0, 1, 2]`, twice",
|
|
461
|
+
"```",
|
|
462
|
+
"; [1, 2, 3] & []",
|
|
463
|
+
"# [[1], [2], [3]]",
|
|
464
|
+
"; .m ([1, 2] & [0]);",
|
|
465
|
+
"; [m, (m .0) === (m .1)]",
|
|
466
|
+
"# [[[0, 1], [0, 2]], ()]",
|
|
467
|
+
"; .r [0];",
|
|
468
|
+
"; [([1, 2] & r) = m, r]",
|
|
469
|
+
"# [<>, [0]]",
|
|
470
|
+
"```",
|
|
452
471
|
"## A name applies like the value it names",
|
|
453
472
|
"",
|
|
454
473
|
"**Decision.** Naming a receiver does not change what applying it answers, so a",
|
|
@@ -803,12 +822,6 @@ export const HC_SOURCES = new Map([
|
|
|
803
822
|
"",
|
|
804
823
|
"## What this file does not decide",
|
|
805
824
|
"",
|
|
806
|
-
"- whether an aggregate in a map refuses. The notes refused it, on the ground",
|
|
807
|
-
" that one accumulator cannot serve one answer per input. But `[1, 2, 3] & []`",
|
|
808
|
-
" is ordinary application — each element collects into the array, which answers",
|
|
809
|
-
" itself, so the map answers three references to one array. That is useless",
|
|
810
|
-
" rather than incoherent, and refusing it is the same paternalism the closure",
|
|
811
|
-
' form was retired for. It needs an argument beyond "you probably meant `|`";',
|
|
812
825
|
"- whether a string should enumerate characters, closing a11's asymmetry;",
|
|
813
826
|
"- what a receiver answering nil mid-reduce does when it declares no",
|
|
814
827
|
" application. A declared application keeps its receiver on nil, but a closure",
|
package/esm/lib/ops/iterators.js
CHANGED
|
@@ -29,11 +29,20 @@ const members = (source) => {
|
|
|
29
29
|
const elements = source.elements().map((value, index) => tuple(index.toString(), value));
|
|
30
30
|
return [...properties, ...elements];
|
|
31
31
|
};
|
|
32
|
-
/**
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* `&` applies each element on its own and keeps the answers apart.
|
|
34
|
+
*
|
|
35
|
+
* A map never accumulates into its receiver (#417): each element is applied
|
|
36
|
+
* to the receiver's collecting copy, a fresh aggregate sharing its members,
|
|
37
|
+
* as applying through an immutable name already does. A reduce may write its
|
|
38
|
+
* fresh intermediate in place because only the final answer escapes; a map
|
|
39
|
+
* answers once per element, so an aggregate that no name holds would
|
|
40
|
+
* otherwise collect every element and be answered each time.
|
|
41
|
+
*/
|
|
42
|
+
export const MapElements = (source, receiver, receiverState) => new FrameArray(source.elements().map((value) => receiver.collectingCopy().call(value, Frame.nil, receiverState)));
|
|
34
43
|
/** `|` threads each element through the receiver the last step answered. */
|
|
35
44
|
export const ReduceElements = (source, receiver, receiverState) => source.reduce(receiver, receiverState);
|
|
36
|
-
/** `&&` maps the same stream widened to `[key, value]` tuples. */
|
|
37
|
-
export const MapMembers = (source, receiver, receiverState) => new FrameArray(members(source).map((member) => receiver.call(member, Frame.nil, receiverState)));
|
|
45
|
+
/** `&&` maps the same stream widened to `[key, value]` tuples, as `&` does. */
|
|
46
|
+
export const MapMembers = (source, receiver, receiverState) => new FrameArray(members(source).map((member) => receiver.collectingCopy().call(member, Frame.nil, receiverState)));
|
|
38
47
|
/** `||` reduces that widened stream, threading exactly as `|` does. */
|
|
39
48
|
export const ReduceMembers = (source, receiver, receiverState) => Frame.reduceInto(members(source), receiver, receiverState);
|
package/esm/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.23.
|
|
1
|
+
export const VERSION = "0.23.1";
|