Rotate Bjorklund

Hey,
simple question.
Does someone know how to rotate the Bjorklund pattern every bar using .rotate, .collect and Pseq. thanks

this works:
[3, 2].collect{ |numHits| Bjorklund2(numHits, 16).rotate(numHits.rand) };

with Pseq it does not atm:

x = Pseq([3, 2].collect{ |numHits| Bjorklund2(numHits, 16).rotate(numHits.rand) }, inf).asStream;
y = x.nextN(4);`

This produces one rotation.

This produces one rotation, and then embeds only that one rotation into Pseq.

Pseq at that point does not know about any other possible rotations. (It seems to be a common point of confusion in SC. When you supply an expression as an argument to a method call, the method receives the result of the expression. The expression itself is no longer available to run repeatedly “per bar” or other.)

So you would need to generate the Pseq dynamically, probably using Plazy:

Pn(
	Plazy {
		Pseq(... bjorklund stuff..., 1)
	},
	inf
)

hjh

thanks you very much. that works fine:

(
x = Pn(
	Plazy {
		Pseq([3, 2].collect{ |numHits| 
			Bjorklund2(numHits, 16).rotate(numHits.rand) 
		}, 1)
}, inf).asStream;
y = x.nextN(4);
)