[chuck-users] Problem with mixed float int lists
Hans Aberg
haberg at math.su.se
Wed Dec 9 07:14:16 EST 2009
ChucK does not admit explicit lists with numbers bot having and not
having the decimal point, as in the example below.
The problem is really that I made a program that writes tuning data to
a file, which then should be pasted back into a .ck file. If the float
value has not fractional part, 'chuck' writes it without decimal
point. For example, it writes 440 Hz not 440.0 Hz.
The first idea would be have 'chuck' always writing floats with a
decimal point. But if the tuning data comes from some other source, it
may not have a decimal point. One then ends up editing this data by
hand, which is cumbersome.
So I think 'chuck' should be able to convert explicit mixed float-int
lists to float[].
There might also be some floats formatting capabilities.
Hans
---- float_int_list.ck ----
[0.0, 1.0] @=> float as[]; // OK.
[0, 1.0] @=> float bs[]; // array init [...] contains incompatible
types...
fun void f(float xs[]) {}
f([0.0, 1.2]); // OK.
f([0, 1.0]); // array init [...] contains incompatible types...
f([0, 1]); // argument type(s) do not match:
--------
More information about the chuck-users
mailing list