Doc: PlazyenvirN

Hi all

I am struggling to wrap my head around this example from the doc for PlazyenvirN:

``````(
f = { arg g=0, h=0, dur=1;
Pbind(\degree, Pseq([g, g, h, g, h], 2), \dur, Pseries(dur, 0.1))
};
// compare:
a = Pchain(PlazyEnvirN(f), (g: [1, 2], h: 3, dur:0.2)).trace(\degree).asStream;
c = Pchain(Plazy(f), (g: [1, 2], h: 3, dur:0.2)).asStream;
)

a.nextN(4);
c.nextN(4); // no degrees, because stream ends
``````

Obviously I don’t quite understand how PlazyenvirN works.
I tried a.next, which gives these results:

``````1
-> ( 'degree': 1, 'dur': 0.2, 'h': 3, 'delta': 0.0,
'g': [ 1, 2 ] )
2
-> ( 'degree': 2, 'dur': 0.2, 'h': 3, 'delta': 0.2,
'g': [ 1, 2 ] )
1
-> ( 'degree': 1, 'dur': 0.3, 'h': 3, 'delta': 0.0,
'g': [ 1, 2 ] )
2
-> ( 'degree': 2, 'dur': 0.3, 'h': 3, 'delta': 0.3,
'g': [ 1, 2 ] )
``````

I would have expected that this “(g: [1, 2], h: 3, dur:0.2)” would be “assigned” to the f function and to see something related to “h” as a third call of next. And where are these dur and delta values coming from?

Thanks for clarification!

PlazyEnvirN appears to parallel-ize arrays – the `[1, 2]` for g gets split out into two separate Pbind patterns, and then these are combined using Ppar.

So the resulting Ppar should initially produce degree 1 from one Pbind, and degree 2 from the other, simultaneously. But, because they come from different patterns, they must be separate events. “Simultaneously,” then, is `delta: 0.0`.

hjh