[plt-scheme] using plt-match.ss in teaching languages

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Fri May 2 12:15:33 EDT 2008

The following program works in Advanced Student.

(require (lib "plt-match.ss" "mzlib"))

(define-struct myposn (x y))

(define (dist p1 p2)
   (match `(,p1 ,p2)
     [(list (struct myposn (x1 y1)) (struct myposn (x2 y2)))
        (sqrt (+ (sqr (- x1 x2)) (sqr (- y1 y2))))]))

(dist (make-myposn 0 0) (make-myposn 3 4))

If I run it in Intermediate Student with lambda or below, I get the 
following error:

map: all lists must have same size; arguments were: list (list #<syntax> 
#<syntax>) (list false)

This is in 3.99.0.18-svn16mar2008.

Is there a way to get match working in lower-level languages? Beginning 
Student with List Abbreviations would be ideal. Thanks. --PR


Posted on the users mailing list.