[plt-scheme] The perfect teaching language--Is this too much to ask for?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Jun 15 14:00:30 EDT 2009

Committed to code base. Documentation will show up after dental  
cleaning app't :-) -- Matthias





On Jun 15, 2009, at 10:07 AM, Matthias Felleisen wrote:

>
> Thanks. This has been on my todo list. I considered adding
>
>  (world? ...)
>
> to big-bang descriptions and
>
>  (universe? ...)
>
> to universe descriptions. -- Matthias
>
>
>
> On Jun 15, 2009, at 9:52 AM, Stephen Bloch wrote:
>
>>
>> On Jun 13, 2009, at 7:04 PM, Todd O'Bryan wrote:
>>
>>> Have you never had a student try to return a number instead of a  
>>> posn?
>>> Or (much more common and much more painful) in the chapters on  
>>> binary
>>> trees and family trees, students get confused about the kinds of
>>> structures they're building and bury a mistake so deep in a  
>>> structure
>>> that by the time they get the error message it's not clear where  
>>> they
>>> painted themselves into a corner. These are the problems that they
>>> spend ten or fifteen minutes staring at, and when I get there, I  
>>> know
>>> it's a type problem, but there are three or four functions, all with
>>> working test cases that could have triggered the problem, and I have
>>> to spend 5 minutes unwinding everything with them.
>>
>> One of the things I've run into frequently in student programs is  
>> event handlers (for world.ss) that return a different type of  
>> "world" than they took in.  This doesn't generally produce an  
>> error message until the NEXT event, at which point the student  
>> gets an error message from a different handler that may be  
>> perfectly correct.
>>
>> Here's a suggestion: add to world (now universe) an optional  
>> "legal" handler (defaulting to (lambda (x) #t) ) that is applied  
>> to the model returned by every handler, before doing anything else  
>> with that model.  If it returns false, the animation ends with an  
>> error message saying "Invalid world returned by ___ handler" (fill  
>> in the blank with "mouse", "tick", or "key").
>>
>> For example,
>>
>> ; The model for this animation is a non-negative number.
>> (legal-when (lambda (r) (and (number? r) (>= r 0)))
>>
>> ; End the animation when the model exceeds 300.
>> (stop-when (lambda (num) (> num 300)))
>>
>> ; Tick handler: add1
>> (on-tick add1)
>>
>> ; Redraw handler:
>> (on-redraw (lambda (r) (circle r "solid" "blue")))
>>
>> This would not only make it easier for students to find their  
>> bugs, but give them some actual code to write at the "choose a  
>> type for the model" step of the animation recipe.  Students have a  
>> tendency to skip steps that don't produce code.
>>
>> Of course, enforced contracts would take care of the issue too,  
>> but I think we'll have to wait longer for them; this addition to  
>> "universe" could be in the next release.
>>
>> Stephen Bloch
>> sbloch at adelphi.edu
>>
>>
>>
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.