[plt-scheme] Using student-defined structures in a teachpack

From: Mike Burns (mike at mike-burns.com)
Date: Sun Dec 11 01:17:45 EST 2005

I'd like to have a teachpack which allows the student to define her own 
Point struct such that the functions in the teachpack work with the 
student-defined Point. For example,

Teachpack:

  (module a mzscheme
   (provide point->pair)

   (define (point->pair a-point)
    (cons (point-x a-point) (point-y a-point))))

Definitions window (with the above teachpack loaded):

  (define-struct point [x y])
  (point->pair (make-point 1 2))

Any tips on how such a teachpack could be written?

-- 
Mike Burns mike at mike-burns.com http://mike-burns.com


Posted on the users mailing list.