Merge remote-tracking branch 'origin/solo' into 25.8.1

This commit is contained in:
Jade (Rose) Rowland
2025-07-27 23:35:25 -04:00
+9 -2
View File
@@ -138,9 +138,9 @@ export function repl({
// allows muting a pattern x with x_ or _x
return silence;
}
if (id === '$') {
if (id.includes('$')) {
// allows adding anonymous patterns with $:
id = `$${anonymousIndex}`;
id = `${id}${anonymousIndex}`;
anonymousIndex++;
}
pPatterns[id] = this;
@@ -201,6 +201,13 @@ export function repl({
let { pattern, meta } = await _evaluate(code, transpiler, transpilerOptions);
if (Object.keys(pPatterns).length) {
let patterns = Object.values(pPatterns);
// if there are solo patterns, only use those
const soloPatterns = Object.entries(pPatterns).filter(([key]) => key.length > 1 && key.startsWith('S'));
if (soloPatterns.length) {
patterns = Object.values(Object.fromEntries(soloPatterns));
}
if (eachTransform) {
// Explicit lambda so only element (not index and array) are passed
patterns = patterns.map((x) => eachTransform(x));