So i’ve been getting deep into “conditional composition” and Pif is super convenient for this in most cases. It does, however, get confusing and laborious when multiple cases are stated. At the moment I achieve this by nesting multiple instances of Pif.
It would probably be easier to do this sort of thing with a switch in a routine or, come to think of it, Pfunc.
Oh well, I’m really just curious about other techniques you folks are employing that would be characterized as “conditional composition”.
This concept super exciting to me and is probably the main draw for me with supercollider as conventional daws really doesn’t offer it as a functionality. At least not in the general sense that is possible in SC.
I don’t know, man, but that paper is about function composition – i think the OP was more getting at alternative bases for Belnap’s four-valued logic, maybe to provide complete equational axiomatizations for them. One is called conditional composition logic. It has a single, ternary if-then-else connective with a sequential, operational reading, and four constants for the truth values. The other logic is called guard logic. The main motivation for this logic lies in its technical properties. It admits a useful type of canonical form (term representation), and a relatively simple strategy for equational reasoning.
All jokes aside, if you use patterns, you may want to check out things like
Prout. Allows you to write your “compositional logic” as if it were a function, and you can “yield” (think of it as a kind of return) values from it. The difference with a normal function is that the next time Prout gets called, it simply continues execution from where it last yielded a value.
Plazy allows you to return a pattern from a function. In the function you can have conditions to decide what kind of pattern to return e.g.
Pfunc Allows you to return a value from a function.
Yeah i’ve been playing around with these. I’m just getting in the habit of relying on Pif for the most part. Combining it with various sorts of data sharing from different patterns and elements brings interesting results.
If I allow myself to dream I’d love if there was a switch equivalent to Pif with case and default statements like in C instead of simple boolean.
This is the sort of thing I like doing. The above example is obviously simplified but you can get some interesting “generative” structures and rhythms when a bunch of things are interacting with a bunch of other things. @dkmayer’s PSx stream patterns are super useful for this as it allows for data sharing of past events in a neat manner. Still digging through that suite though and trying to find an optimal way of integrating it into my workflow.