[chuck] (no subject)

Adam R. Tindale adamtindale at hotmail.com
Wed Feb 16 18:48:02 EST 2005


Hi All,

When you do division on two durs a float is returned. When you divide a 
dur by a float you get a dur as well.

There are some examples on the reserved words page on the docs site.

Here is how you can divide two durs to make a new dur.

10::second => dur a;
5::second => dur b;
a/b => float g;
g::second => dur newdur;

Doing

a/b::second => dur q;

gives a parse error however.

This works nicely though.

10::second => dur a;
a/2. => dur b;

Hope that helps.

art

On Feb 16, 2005, at 3:11 PM, Philip Davidson wrote:

> Micheal,
>
> math on durs is supported, but not completely
> ( some revision to dur handing is needed )
>
> dur * float => dur ;  should work.
> not sure about float * dur => dur;
> I don't believe that division is properly supported.
>
> this code would work
> --
> 1::second => dur beat;
> beat * 0.5 => dur h;
> -or-
> beat * 0.5 => now;
> --
>
>
> where it stands for now...
>
> Phil
>
>
>
> On Feb 16, 2005, at 5:43 PM, Michael Heuer wrote:
>
>> Hello ChucKers,
>>
>> Is there any way to go from an int or float value of a variable to a
>> duration? e.g.
>>
>> 1 => int value;
>> value::second => dur some_unknown_number_of_seconds;
>>
>> What I'm really trying to do is math with durations and numbers,
>>
>> 1::second => dur w;
>> (w / 2) => dur h;
>>
>> Thank you,
>>
>>    michael
>>
>> _______________________________________________
>> chuck mailing list
>> chuck at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck
>
> _______________________________________________
> chuck mailing list
> chuck at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck
>




More information about the chuck mailing list