This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: defmacro question
- To: Per Bothner <per at bothner dot com>, kawa at sourceware dot cygnus dot com
- Subject: Re: defmacro question
- From: ygrats at gmx dot net
- Date: Thu, 10 Aug 2000 09:30:29 +0200 (MEST)
- References: <m2zommpeop.fsf@bothner.com>
> ygrats@gmx.net writes:
> > I like macro defining macros, and this only can be achieved using
> > "defmacro" not "define-syntax", as it seems.
>
> I think you shoudl be able to use define-syntax to define macros.
> If you can't, please send a test-case.
I used to do this in Common-Lisp. I have had a look at R5RS, but up to
now, I don't see how I can do something like the following in Scheme using
define-syntax.
(defmacro import-jtype (java-type scm-name)
(let ((scm-name-string (string-append "j" (symbol->string scm-name))))
`(begin
(defmacro ,(string->symbol
(string-append "make-" scm-name-string))
args
`(apply make ,,java-type ',args))
(defmacro ,(string->symbol
(string-append scm-name-string "?"))
(obj)
`(instance? ,obj ,,java-type))
(define ,(string->symbol scm-name-string)
,java-type))))
Cheers,
Martin
--
Homepage: http://jove.prohosting.com/~ygrats/
Mail: ygrats@gmx.net
Sent through GMX FreeMail - http://www.gmx.net