[plt-scheme] Using student-defined structures in a teachpack

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Mon Dec 12 15:54:59 EST 2005

On 12/12/05, John Clements <clements at brinckerhoff.org> wrote:
> On Dec 10, 2005, at 11:15 PM, Carl Eastlund wrote:
> > This seems like a very bizarre thing to ask them to do.  It has
> > nothing to do with any coding practice anyone will have to do - you
> > never have to write a data definition with the requirement that it fit
> > code already written based on assumptions about it.  Perfectly valid
> > solutions (changes in structure or field name, or reversed field
> > order) will yield errors instead of working.
> Huh?  AFAICT, this is the very _essence_ of component-based programming.
> Mike, what I'm seeing here is a fine programming problem, but not one
> that is a natural fit for the teachpack model.  It looks to me like
> you want the library code to depend on the student's code.  I see two
> solutions:
> 1) turn the code into units.  Then, the teachpack might provide a
> function, "link-up", that links the user's unit implementing the
> point with the library code that wants to use it.
> 2) Dump the teachpack approach, and just write library code that
> depends on a module that the user must provide.
> I agree completely with Carl that you almost certainly _don't_ want a
> hygiene-breaking solution like the one you seem to be proposing.

I'm going to let the timestamps on my prior emails (so late it's
early) explain my thickness...  Yes, of course one can write a program
like that.  The problem statement for the first part might be "write a
data definition for a point and provide functions get-x and get-y
which do the following ..."  Then the provided code can depend on
get-x and get-y.  (That way the student can, in fact, solve the
problem with many different data definitions.)  I was interpreting the
problem format too rigidly.


Posted on the users mailing list.