[plt-scheme] kids, worlds and functional updates

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Sat Sep 26 15:07:10 EDT 2009

Hi Yaron,

We have an internal version that defines updaters automatically.
Thus, if you

(define-struct world (pos vel))

you will automatically get

update-world-pos: world x pos -> world
update-world-vel: world x vel -> world

We did not do this initially because, as you point out, the student
could write these updaters themselves.  However, it's conceivably also
a barrier for some to have to create the abstraction every time.
Personally, I'm leaning towards giving them the updaters, then showing
them that they could have built them for themselves.  (In that sense,
the updaters would be unlike everything else that DEFINE-STRUCT
provides, in that the other pieces they *couldn't* build themselves.)

Recreating the entire struct from scratch is good to do initially
because it helps confirm that the students know what they're really
doing, rather than hiding the details under some magical construct
that they only use, not understand.  It's similar to using CONS to
make lists initially, before showing them LIST and QUOTE.

Shriram


Posted on the users mailing list.