I would like to propose that some list patterns (Pseq, Prand, Pwrand) be able to take a pattern in their list argument.
This makes it possible to use Pstep or Pseg to change the collection of values used over time.
In the case of Pseq, the pattern would get an array from the list stream, iterate and then get another. This does not change
Also, I notice that Pseq has this support for a 'reverse' key. This seems pretty hackish as it would apply to all
Pseqs in the event stream. Am I missing something? I wonder if this switch could or should be deleted:
Pseq : ListPattern {
var <>offset;
*new { arg list, repeats=1, offset=0;
^super.new(list, repeats).offset_(offset)
}
embedInStream { arg inval;
var item, offsetValue,listStream, listVal;
offsetValue = offset.value;
listStream = list.asStream;
if (inval.eventAt('reverse') == true, {
repeats.value.do({ arg j;
listVal = listStream.next(inval);
if (listVal.isNil) {^inval };
listVal.size.reverseDo({ arg i;
item = listVal.wrapAt(i + offsetValue);
inval = item.embedInStream(inval);
});
});
},{
repeats.value.do({ arg j;
listVal = listStream.next(inval);
if (listVal.isNil) {^inval };
listVal.size.do({ arg i;
item = listVal.wrapAt(i + offsetValue);
inval = item.embedInStream(inval);
});
});
});
^inval;
}
storeArgs { ^[ list, repeats, offset ] }
}
RJK