[plt-scheme] syntax question
Artem Baguinski
artm at v2.nl
Thu Oct 7 06:37:43 EDT 2004
Hello
I'd like to implement the following macro:
(define-readable-structure
name
((field reader)
...))
which would expand to
(define-struct
name
(field ...))
and a reader function:
(define read-name
(lambda (port)
(let* ((field (reader port)) ... )
(make-name field ...))))c
but i have no clue where to even start... my problems:
1. How to generate reader function name? And how to make sure it's visible
outside the macro definition, as if i supplied it to
define-readable-structure.
2. How to find out structure's constructor name and insert it into reader
function?
3. May be something else i don't realise? Or may be there's some way to do
what I want already in mzscheme or mzlib? What i want is a structure that
knows how to read itself from port using supplied field readers.
--
gr{oe|ee}t{en|ings}
artm
More information about the plt-scheme
mailing list