[chuck-users] durations and control structures
timsutton at fastmail.fm
Wed Apr 19 20:31:02 EDT 2006
Thanks Ge, that was simple enough!
I suppose controlling shreds would involve and removing shreds around
a central structure like this?
Once I spork one shred, can I give it a name so that I can remove it
with chuck code?
On 19-Apr-06, at 5:09 PM, Ge Wang wrote:
>> Hi there list,
> Hi Tim!
>> I'm new to this chuck business and am trying to get a handle on a
>> number of things - timing and durations are one of them. If I have a
>> chunk of code that I'd like to run for a specific duration of time,
>> how could I go about defining this in the control structure?
>> something like
>> while (duration condition here)
>> do this
> Depending on what you want to do, there are many ways to run a
> chunk of
> code for a specific duration of time. One of the ways to use time in
> the loop conditional:
> // some length of time
> 20::second => dur length;
> // compute end time relative to now
> now + length => time later;
> // this should run the loop for duration 'length'
> while( now < later )
> // do stuff, make sure to advance time somewhere
> This is one way, and of course the specifics depend on your
> application. You can also do this with multiple shreds, where one
> controls others. Let us know if you have questions with that.
> I hope this helps.
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
More information about the chuck-users