Hi Enrike, On Nov 13, 2006, at 9:08 PM, altern wrote:
hi again
here i am with couple of questions again.
is there a way to concatenate strings? I am trying different ways with no much luck and i have checked the docs but i could not find a way to it.
Not at the moment... this is a high priority on the ChucK wish list, however.
another issue is: is there a way to eval a string as code like in python or actionscript?
Also not at the moment... with string operations and the also highly desirable file i/o this would be somewhat possible to do, though.
The questions come from some commands i am forced to type over and over despite of being almost identical
recv.event("/0/mute, i") @=> OscEvent mute0_osc;
the only difference of the number (0 in this case) for each of the sample players i have constructed
Would it be possible to create variables on the fly from concatenated strings? I mean something like (in wish code)
for (0 => int n; n < 8; n++){ "/" + Std.itoa(n) + "/mute, i" @=> string address; //concatenate string recv.event(address) @=> OscEvent Std.eval("mute"+ Std.itoa(n) + "_osc"); //concatenate and eval string }
I think code like this is really powerful and really useful, but unfortunately it sort of throws a big huge wrench into the type systems of languages like ChucK. So, to be honest, I don't see something like this usage of Std.eval becoming possible in the near future. For what it's worth, once string operations are fully implemented, something resembling this will be possible: OscEvent mute_osc[8]; for (0 => int n; n < 8; n++){ "/" + Std.itoa(n) + "/mute, i" @=> string address; //concatenate string recv.event(address) @=> mute_osc[n]; } This is similar to your wish code, though not as dynamic or flexible of course. thanks, spencer
thanks
enrike
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users