[racket] match in Advanced Student?

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Wed Aug 17 12:58:59 EDT 2011

On Aug 17, 2011, at 12:11 PM, Jay McCarthy wrote:

> On Wed, Aug 17, 2011 at 8:30 AM, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
>> My experience last year was that the restrictions on some of these
>> sub-forms were arbitrary and not helpful. It also makes it harder for
>> students because if they click on the "wrong" documentation, they
>> don't understand why the thing that the docs say should work doesn't.
> There's nothing really sacred about the restrictions. I believe I just
> did what you wanted. Do we want to remove the restrictions? As far as
> I know, there's no book that makes any reference to match.

I've considered using it in the classroom.  A lot of my students expect pattern-matching to work already, even in function headers:

(define (swap (make-posn x y)) (make-posn y x))

And why SHOULDN'T this work?  Please phrase your answer in a way that makes sense to a first-semester programming student :-)

However, I don't think I mentioned "match" anywhere in _Picturing Programs_.

On the subject of unnecessary restrictions, why does "(require (planet somebody/something))" work in #lang racket/base but not in student languages?

Stephen Bloch
sbloch at adelphi.edu

Posted on the users mailing list.