[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] A method.chaining idiom for livecoding?




Am 31.12.2018 um 17:34 schrieb tedthetrumpet@xxxxxxxxx:


Pbindef(\a, \note, {{7.rand}.dup(8).pseq(4)}.plazy.repeat) // works
// but, without the function braces, doesn't work as intended, repeats one pattern forever
Pbindef(\a, \note, {7.rand}.dup(8).pseq(4).plazy.repeat)


That's expected behaviour. From the definition of plazy for Pattern and Functions follows:

If plazy is applied to a Pattern, this Pattern is instantiated immediately 
(at pattern instatiation time, before the stream is derived and evaluated repeatedly),
if plazy is applied to a Function, the Function is evaluated when demanding from the stream whenever necessary 
(this can be several times if the Plazy is repeated and the inner Pattern is finite)

It is indeed a subtle difference, I suggested to define it that way
because you wanted to save the curly brackets in a certain case:

>Would like to be able to write this
>Pbindef(\a, \note, (0..7).pseq(4).plazy.repeat)

>Or possibly this, although not as good:
>Pbindef(\a, \note, {(0..7).pseq(4)}.plazy.repeat, \dur, 1/4)

With Pseq there's no random, so the difference is not striking.
With Pshuf you really save the curly brackets.

You can see it also like this: with a Function you get delayed ("lazy") evaluation,
but actually also Pshuf implements a lazy evaluation because with a new embedding
you get a new order.
Functions are an abstraction, Patterns are in a similar way,
both are recipes for algos, but not the performance of the algo itself.

Regards

Daniel

-----------------------------
http://daniel-mayer.at
-----------------------------