[plt-scheme] Repl during animation or simulation
Ryan Culpepper <ryanc at ccs.neu.edu> writes:
> Greg Santucci wrote:
>> On Thu, Jun 4, 2009 at 12:51 PM, Ryan Culpepper <ryanc at ccs.neu.edu> wrote:
>>
>>> The alternative is to create a separate thread for your program's
>>> execution. While it's running in the other thread, you can execute commands
>>> in the REPL that change its behavior. PLT Scheme has many options for
>>> managing concurrency and communication, from semaphores to channels
>>> (synchronous and asynchronous) and synchronizable events.
>>>
>>>
>> That's good to hear. How do you launch your app in a separate thread from
>> the REPL? Is there an example of what you're describing?
>
> It's easiest if you've already created a main function that starts all
> the work. Suppose it's called 'run-simulation'. Then instead of
> something like this
>
> (run-simulation some-arguments)
>
> to start it in a new thread, write this instead:
>
> (thread (lambda () (run-simulation some-arguments)))
>
> There are some distantly related examples of threads in "More: Systems
> Programming with PLT Scheme" in the help desk:
>
> http://docs.plt-scheme.org/more/
>
> Ryan
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
Fluxus use this feature to enable live-coding "in the loop" :), you can
take a look at it and maybe borrow some ideas or even "ab"use it. Take a
look at it from www.pawfal.org/fluxus.
cheers,
glauber.