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

From: John Clements (clements at brinckerhoff.org)
Date: Tue Jul 7 12:31:57 EDT 2009

On Jul 7, 2009, at 9:26 AM, John Clements wrote:

>
> On Jul 7, 2009, at 9:15 AM, Prabhakar Ragde wrote:
>
>> 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 you're misunderstanding me, though I now see that what I  
> said wasn't well explained.  The point about symbol pattterns  
> stands, but you *can* write structure patterns just fine; all I was  
> suggesting was that if you introduce structures in this way, then  
> when you want to show the kids how to use filter to extract all of  
> the llama's from a list, you have to explicitly introduce 'llama?'  
> or let them write it themselves.
>
> John
>
>> 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.
>
> That's the traditional approach (IIUC), and it may well lead to  
> better understanding.

Just to be a bit more inflammatory: I'm not showing them 'cond'; just  
'match'.

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20090707/8895e234/attachment.p7s>

Posted on the users mailing list.