@jancsika It is pretty cool!
-
Paradigms useful for teaching Pd
-
Interesting progress on this thread! I'd dropped off -- will have to catch up.
Of scripting languages -- I'll get myself in hot water for saying this, but every really cool max or pd project I've seen involves some scripting objects somewhere. There are some things that are really hard to say with patch cords, that are very easy to say in imperative (or functional!) code -- and other things that are easy to say in patch cords that are harder in code (such as, my GUIs in SuperCollider usually have some model-view-controller glue underneath -- which is robust but you can't explain it in two sentences like you can explain a pd slider wired up to something).
Ofelia is quite nice for providing access to coding style logic with patches inlets and outlets.
hjh
-
@jancsika I made a version of [dup] with another coding approach. It should work mostly the same, supports counting for [dup 22] and also supports short styles like [dup 5 15 2] or [dup 2 = 10].
There is actually a trick: As long as the first line is not a single number, it will just assume the first number to be "from", the second number "to" and the third number "step", regardless of other symbols. It assumes "<" or ">" as default, only if it detects a "=" it will add another step.
-
@ingox Nice.
Once I added the semicolon-separated message args to hand off to expr, it didn't seem as pressing to allow expressions inside the conditions. At that point it just seemed easier to specify the loop length with a single floatarg and do whatever with "i" in the body.
I think this method of leveraging expr is probably useful for something like
[array foreach]
[array foreach e, i; e * 2; i;
That is-- for each element of the list, output a list containing the current element multiplied by two, followed by the index.
But I guess you have to name the object something other than "array"...
-
@jancsika This works (has to have spaces around i ):
-
On the other hand, all this is just a little bit fancier then [expr]. [loop] + [expr] give the same result: