mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-27 15:29:18 -04:00
Merge remote-tracking branch 'origin/solo' into 25.8.1
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user