[racket] list in Beginning Student

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Oct 2 12:13:57 EDT 2011

On Oct 1, 2011, at 7:28 PM, Prabhakar Ragde wrote:

> On 10/1/11 8:33 AM, Todd O'Bryan wrote:
>> I actually wish it weren't in there. One student discovers it, and
>> lots of students start using list instead of cons ... empty. That
>> wouldn't be a problem except that most of them don't have the
>> conceptual chops yet and I have to fix their confusion.
> Yes. I have noticed confusion of (list x y) and (cons x y). And I still don't know where they get (append (list x) y) and how to prevent it.
> Another thing I might take out is `reverse'. They tend to use it to fix up recursions that they've gotten wrong. They can't write an efficient version using the templates, and they think that every built-in function is "free" in some sense, even as they carp about having to, say, do two recursive computations on the same list instead of putting them in "one loop".

In the past I noticed such confusions, too, when I went extremely fast -- "alluding" to the design recipe only -- until I hit difficult recursions. I have found that it is important to drill the design recipe and to motivate the pieces: empty? and cons? are simple constant checks (check a struct), cons is a simple one-step operation (create a struct), append is a recursive function, etc. We never have enough time to make it trully fully sink in, but the danger with people who seemingly 'get it' when we go fast is that they neither appreciate it nor actually understand it. 

-- Matthias

Posted on the users mailing list.