[Edu-sig] re-doing GvR in xturtle

kirby urner kirby.urner at gmail.com
Mon Aug 14 17:38:23 CEST 2006


> No, you did not miss it.  "Evaluate" is used, among others, with an
> "editor" (html textarea).  Upon clicking on the Evaluate button, the
> code is executed within its own local dict, to avoid possible
> interference with Crunchy's own code.
>

That is of course the safest thing, and the least confusing in some
applications.

My model coming in, to the genre of interactive tutorials, was the way
J allows users to build "labs" that walk you through a module.  A
little text, a little play, a little text, a little play, just like
Crunchy.  But stuff we've taken the trouble to define at the top,
remains relevant through the session.  So if there's a function def,
you want that in local memory, until with lab is completed.

I think you've given the idea of an easy work around in Crunchy.  Put
all the accumulative code in a module and just import it in every VLAM
to populate a namespace.  Like we import string for example (which I
don't want to go away, but maybe that's just me).

The specific application I have in mind (lesson plan, Crunchy Frog
XHTML), involves defining Integers Modulo N, not by subclassing int or
anything, but simply by redefining __add__ __mul__ and their inverses,
modulo some class variable.  I've written the module many times.  Once
a student VLAMs the class def, I want new objects to be instantiable
throughout.  The solution is easy:  import modulo in each VLAM
textarea.

Kirby


More information about the Edu-sig mailing list