[plt-scheme] Perplexed Programmers

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Sep 1 09:51:33 EDT 2007

On Sep 1, 2007, at 7:30 AM, Geoffrey S. Knauth wrote:

> On Aug 31, 2007, at 11:06, Matthias Felleisen wrote:
>> On Aug 30, 2007, at 1:50 PM, Geoffrey S. Knauth wrote:
>>> Can we make a library of structure and algorithm templates for  
>>> DrScheme that can be called up at the press of a button?
>>
>> Absolutely. And it would be a disaster for beginning students. We  
>> knew this in 1995 and we had a request for that in 1996 from a  
>> colleague at Rice. He was in graphics and came from the Fortran  
>> compiler community. Code was code.
>
> I see your point.  Maybe after a student writes a template, there  
> could be a Check Template feature.  The template patterns you want  
> people to learn


But that's missing the whole point! There is no fixed set of  
templates!!! Given a nest of data, you get a different template. We  
have actually started calling it inventory now, to signal that it is  
just a collection of all knowledge about the program's organization  
(that you get from the input data).


> could be given names.  After a student creates a template, a  
> recognizer would look at it and tell the student, "This fits the  
> Xyz pattern."  If that's what the student intended, great.  If the  
> recognizer didn't like the template, it would say, "I don't  
> recognize this" or "This almost looks like Xyz," leading the  
> student to keep trying.

No! What you could do is -- say after three or four weeks -- have  
students spell out the structure of the data with code:

  (define-data List-of-numbers
    empty
    (cons Number List-of-numbers)))

and annotate functions with input types:

  (define: (f {l : List-of-numbers})
    (cond
      [(empty? l) ...]
      [(cons? l) ... (first l) ... (f (rest l)) ...]))

Checking this should be feasible. -- Matthias




Posted on the users mailing list.