On Mar 29, 2:08 am, "firstname.lastname@example.org" <email@example.com> wrote:
> Is it possible to define-syntax "define-struct" ? Do you mean the "define-struct" like the one described in the
To do that, you need two things:
1. A suitable representation for the struct types.
2. A macro system.
> Mit scheme don't have mzscheme type define-struct. I don't know much about MIT Scheme but here is the general idea.
If your Scheme system provides the means for creating new record/
struct types, then you can use that as a basis for the representation
of your structs. Otherwise, tagged vectors (i.e. vectors where the
first element is a descriptor for the struct type) may work ok.
If your want "define-struct" to construct the constructor, predicate,
accessors and setters names for you, then you need a macro system that
has that capability. A syntax-case system would work nicely. If all
you have is syntax-rules, then you need to specify the names of all
the procedures in the define-struct form. This would make define-
struct forms look something like:
(define-struct foo make-foo foo?
instead of the much shorter form:
(define-struct foo (bar baz ...))
Does this answer your question? Let us know if you have any troubles.