[plt-scheme] match not working under plai

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Sep 26 00:01:03 EDT 2005

At Sun, 25 Sep 2005 16:49:30 -0400, "Dave Tucker" wrote:
> Using the PLAI - Advanced Student language, the following program:
> 
>   (require (lib "match.ss"))
> 
>   (match '(1 2)
>     [`(,a ,b) (+ a b)])
> 
> gives the error:
> 
>   match: no matching clause for (list 1 2): (plt:match (quote (1 2)) 
> ((quasiquote ((unquote a) (unquote b))) (+ a b)))
> 
> Under other languages, the program correctly produces 3.  Any idea
> what's wrong?  Thanks.

The PLAI `quasiquote' is not the MzScheme `quasiquote'. (The PLAI one
is the same as the HtDP one, which disallows the construction of
non-list pairs.) The `match' form recognizes uses of MzScheme
`quasiquote'.

The following works in PLAI Advanced:

 (require (lib "match.ss")
          (only mzscheme quasiquote unquote))

 (match '(1 2)
   [`(,a ,b) (+ a b)])


Matthew



Posted on the users mailing list.