[Gridflow-dev] ping (fwd)

Tom Schouten doelie at zzz.kotnet.org
Sat Sep 11 18:59:02 EDT 2004


On Sat, Sep 11, 2004 at 10:07:03AM -0400, Mathieu Bouchard wrote:
> 
> On Thu, 9 Sep 2004, Tom Schouten wrote:
> 
> > > Ok, I didn't know Forth supported coroutines. 
> > depends wether you implement it, actually.
> > because of the direct access to the return stack, you can create
> > all kinds of control structures, including coroutines/tasks/generators,
> > all flavours and variants.
> 
> Ok, how do *you* implement coroutines, and why?
>

why?

biggest reason would be to facilitate using state machines. this is
mainly for the opengl/drawing part, but it is nice to do sequencing
in pd too.

i've found state machines to be far superior for most cases compared 
to objects with a 'tick' method.

in mole i use tasks like this to implement a pattern sequencer.

i use this for a psychologic experiment (cross modal perceptual
psychology) where pf runs in pd, and for each frame, a 'bang'
is sent to the pf object, which then resumes the main experiment
sequencer until it yields back again.

this enables you to do stuff like '10 for yield next' to
just wait 10 frames and then start doing other stuff, without
ever having to 'return' and 'switch (state) {case, case, case}'.


how?

currently they are implemented as tasks, not pure coroutines, but
that's easily added. i didn't need pure coroutines yet.

a task in pf is a list wich contains 2 sublists: the data stack 
(DS) and the return stack (RS). this represents local execution
and data context, and can be considered as a continuation.

currently i use a very simple round-robin scheduler as a synchronization
method between tasks. this enables to do somple cooperative multitasking.

there's a lot of ways to do this really. because you have explicit
access to DS and RS, you can implement any control structure you like.



 
> > > It's not an explanation, it's just praise. An explanation actually
> > > explains something.
> > you like terminoligy wars, don't you? :)
> 
> Terminology wars is about ownership in "word territory"; the goal is to
> make other people believe one's own definition of a word is more right
> than the others, even than the official/default ones. Then you can use the
> resulting confusion to cause existing written texts to mean something else
> than what they were intended to mean, because the reference has shifted to
> different referents. It is about using a word as a leverage for power.
>

do you read Dennett?

 
> > > > > The best example of it in GridFlow is [#remap_image].
> > > > it seems to me you're describing systolic arrays.
> > yes, array can be anything that the topoly allows. usually only
> > linear and planar though, but systolic arrays are really used a lot in 
> > specialized hardware:
> 
> Well, I don't know that one object is supposed to count as a "systolic
> array". Reading the article I get the impression that you have to connect
> a bunch of them together, e.g. each left-outlet connected to the
> left-inlet of the object below, and each right-outlet connected to the
> right-inlet of the object to the left. 

yes. the main use for systolic arrays is to implement matrix operations
in hardware in a very parallel, pipelined way. to the structure is usually
very regular.

> Different topologies have different
> patterns of connection for sure, but here i say it's not the same, maybe
> i'd call it a "knot" in the flow, whereby one object is involved twice
> during _one_ chain of processings, distinguishing between the two by using
> two different inlets, and the second involvement completes the task begun
> in the first. Just a way of "passing objects as arguments to other
> objects" in Pd. I haven't seen anyone else use such a pattern in Pd
> though.

sounds interesting, but it seems like introducing a lot of complexity..



More information about the Gridflow-dev mailing list