[gambit-list] questions about define-type, and structures in general

Matthew Koichi Grimes mkg at cs.nyu.edu
Sat May 21 16:45:45 EDT 2011

I have a few questions about custom types in Gambit. I apologize if they
seem elementary, but I couldn't find an answer in the docs or the mailing
list archives, and I'm new to Scheme.

I've defined a new type "my-type" using define-type. How can I control how
an instance of my-type gets displayed in the REPL? I know I can declare
individual slots of my-type to be unprintable:, but I'd like to just be able
to define a "print-my-type" function that gets called.

Similarly, how can I define a custom constructor that does something more
complicated than assign arguments to slots?

Finally, there seem to be four options for defining structs in Gambit:
define-structure, define-type, srfi-9's define-record-type, and meroon.
Which should I be using? At the moment, I'm only defining very basic
structures (e.g. doubly-linked lists), but my ambitions will probably grow.

-- Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20110521/0546a11e/attachment.htm>

More information about the Gambit-list mailing list