<br><br><div class="gmail_quote">2011/5/21 Matthew Koichi Grimes <span dir="ltr"><<a href="mailto:mkg@cs.nyu.edu">mkg@cs.nyu.edu</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

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.<br><br>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.<br>

</blockquote><div><br>Why would you want this? Anyhow, you could make your own Gambit patch that adds a pp: procedure argument to define-type. Feel free to publish your patch on the Dumping grounds.<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



Similarly, how can I define a custom constructor that does something more complicated than assign arguments to slots? <br></blockquote><div><br>By defining your own procedure that does the job.<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

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.<br>

</blockquote><div><br>Depends on your specific needs. I suppose define-type is more optimized than meroon.<br><br>Someone else please verify that Gambit's define-record-type is just an alternative name for define-type, just like what call/cc is to call-with-current-continuation .<br>

 <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Best,<br>-- Matt<br><br>
<br>_______________________________________________<br>
Gambit-list mailing list<br>
<a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
<a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
<br></blockquote></div><br>