generator functions in another language

castironpi at gmail.com castironpi at gmail.com
Mon May 5 13:08:29 EDT 2008


On May 5, 12:28 am, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> En Mon, 05 May 2008 00:09:02 -0300, hdante <hda... at gmail.com> escribió:
>
>
>
>
>
> >  Isn't this guy a bot ? :-) It's learning fast. I believe there is a
> > "frame" in C, composed of its stack and globals. For generators in C,
> > you may look for "coroutines". For example, see:
>
> >http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
>
> >  A sample code follows:
>
> > #define crBegin static int state=0; switch(state) { case 0:
> > #define crReturn(i,x) do { state=i; return x; case i:; } while (0)
> > #define crFinish }
> > int function(void) {
> >     static int i;
> >     crBegin;
> >     for (i = 0; i < 10; i++)
> >         crReturn(1, i);
> >     crFinish;
> > }
>
> >  The "suspended state" is saved in the static variable. It's not
> > necessary to save the complete "frame", only the suspended state.
>
> Quoting the author himself, "this is the worst piece of C hackery ever seen"
>
> --
> Gabriel Genellina- Hide quoted text -
>
> - Show quoted text -

At some point, code goes "on" and "off" the processor, which knowledge
I do owe to spending money.  Thus, if the group news is a localcy
(other dimension of currency), that's bounce check the house dollar.
What do [second person plural] spend on [vernacular]?

More strictly speaking, processor freely goes on and off binaries.  Is
Goto a hardware instruction?  Perhaps a Linux-Python-binding could
yield a frame, pun intended.  Do [you] have access the file system?

Could yield merely be implemented as multiple strings of processses?
Get the variables on disk.  Question is, is it worth optimizing away
from flash rom?  There's a gig of chips in a bowling ball.





More information about the Python-list mailing list