[plt-scheme] teachpacks, structures, and equality

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Sat Sep 18 21:35:38 EDT 2004

There is something I don't understand about teachpacks. I create one
that says:

  (module test mzscheme
    (provide (all-defined))
    (define-struct mystruct (field1 field2))
    )

and save it as test.ss in the teachpacks directory. Then I create the
following file:

   (define myvar (make-mystruct 1 2))
   (equal? myvar myvar)
   (equal? myvar (make-mystruct 1 2))
   (equal? (make-mystruct 1 2) (make-mystruct 1 2))

When I set the language to Beginning Student, load the test.ss
teachpack, and run this, I get

   true
   false
   false

But if I replace "mystruct" with "posn", all three tests evaluate to
true.

How do I get "equal?" to work with a structure defined in a teachpack?
Many thanks. --PR


Posted on the users mailing list.