[plt-scheme] A data point on 'match' in intro programming: +++!

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Tue Jul 7 12:15:28 EDT 2009

John Clements wrote:

> I'm leading high-school students through the construction of a bare- 
> bones "universe.ss" application that models the prisoner's dilemma,  
> and I decided to import 'match' using a teachpack.  My experience thus  
> far has been completely positive, and if there's a drawback to using  
> 'match' to replace structure-reference functions and predicates, it  
> hasn't come up.
> Well, actually, I suppose I can imagine the following objections:
> - a straightforward import of 'match' doesn't support symbol patterns  
> (presumably, it's a different "quote").
> - you can't do nifty higher-order things with predicates and structure  
> reference functions.

It would be nice if these could be fixed. In the "advanced" first-term 
class I teach to really good students, I could use match pretty early, 
except that I've never been able to get it to do the things I want when 
I try importing it into a teaching language (I definitely want symbol 
patterns and predicates). As it stands, I have to introduce it after we 
move to Module about halfway through, and that's later than I'd like.

I think match as a shorthand for destructuring parallels list and quote 
notation as a shorthand for structuring, and can be introduced after 
some explicit practice with accessor functions. --PR

Posted on the users mailing list.