Any way to call an arbitrary function with some value
I’m pretty sure I know the answer to this already – its not a dynamic language... However, I can put a UGen method into a variable, but I cannot apply it: ... SndBuf2 input; input.gain @=> Object f; ... This compiles, but can I apply it to an argument? Am trying to find a way of modifying arbitrary parameters via osc that doesn’t include writing unmaintainable code: ... if (parameterName == “gain”) myUgen.gain (value); ... etc ... Am I missing something...? -- Rich
Hey, Rich! I’m pretty sure I know the answer to this already – its not a dynamic
language...
Indeed, and not a functional one either... but let's go over it anyway :-)
However, I can put a UGen method into a variable, but I cannot apply it: ... SndBuf2 input; input.gain @=> Object f; ...
This compiles, but can I apply it to an argument?
IMHO you have found a bug. I don't feel this should compile or parse; input.gain is a function and functions are not objects, in ChucK, and hence I feel the assignment should fail with some error message. I can see your reasoning; that if it compiles you'll want to do Useful Stuff with it, but IMHO this situation is the sad result of differences between "ChucK" as a language and the actual chuck compiler/VM.
Am trying to find a way of modifying arbitrary parameters via osc that doesn’t include writing unmaintainable code: ... if (parameterName == “gain”) myUgen.gain (value); ... etc ...
Ok, I can see how the above would look better if we had variables of type function. We don't have those... but your illustration here looks far from "unmaintainable" to me. Indeed it is a bit longer than the alternative in -say- Scheme, but on the bright side; if you make a typo in this kind of situation the parser will likely catch it for you before it compiles at all. That has serious benefits too in how maintainable code is. Hope that helps a bit? Yours, Kas.
The LiCK library has lots of functional programming tools.
https://github.com/heuermh/lick
...
if (parameterName == “gain”) myUgen.gain (value);
... etc ...
You could write your own class where every parameter is accessed via an
associative array using a pattern like "class.set("paramName",
parameterList)"
- George
On Wed, Feb 25, 2015 at 12:19 PM, Kassen
Hey, Rich!
I’m pretty sure I know the answer to this already – its not a dynamic
language...
Indeed, and not a functional one either... but let's go over it anyway :-)
However, I can put a UGen method into a variable, but I cannot apply it: ... SndBuf2 input; input.gain @=> Object f; ...
This compiles, but can I apply it to an argument?
IMHO you have found a bug. I don't feel this should compile or parse; input.gain is a function and functions are not objects, in ChucK, and hence I feel the assignment should fail with some error message. I can see your reasoning; that if it compiles you'll want to do Useful Stuff with it, but IMHO this situation is the sad result of differences between "ChucK" as a language and the actual chuck compiler/VM.
Am trying to find a way of modifying arbitrary parameters via osc that doesn’t include writing unmaintainable code: ... if (parameterName == “gain”) myUgen.gain (value); ... etc ...
Ok, I can see how the above would look better if we had variables of type function. We don't have those... but your illustration here looks far from "unmaintainable" to me. Indeed it is a bit longer than the alternative in -say- Scheme, but on the bright side; if you make a typo in this kind of situation the parser will likely catch it for you before it compiles at all. That has serious benefits too in how maintainable code is.
Hope that helps a bit?
Yours, Kas.
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
hey all, what’s the current status of ChucK on Yosemite? does it work? someone tell me not to upgrade please… tanks, dan
Works fine for me.
On Mar 12, 2015 7:03 PM, "Daniel L. Trueman"
hey all, what’s the current status of ChucK on Yosemite? does it work? someone tell me not to upgrade please…
tanks, dan _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
If you're building from source, I've had to keep this around for a while,
since I need to make sure that all of chuck + chugins + Joel's ladspa
chugin + various ladspa libraries all build with the same new standard c++
lib on OSX 10.9+
https://github.com/ccrma/chuck/compare/master...heuermh:osx-libc-build
I'm not smart enough to know if this should be merged upstream or not.
michael
On Thu, Mar 12, 2015 at 8:03 PM, Daniel L. Trueman
hey all, what’s the current status of ChucK on Yosemite? does it work? someone tell me not to upgrade please…
tanks, dan _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (6)
-
Daniel L. Trueman
-
George Locke
-
Kassen
-
Michael Heuer
-
Paul B
-
Rich Caloggero