From: "Neil Jerram" <neiljerram@googlemail.com>
To: "Pach Roman (DGS-EC/ESG3)" <Roman.Pach@de.bosch.com>
Cc: guile-devel@gnu.org
Subject: Re: define-syntax
Date: Tue, 9 Dec 2008 20:20:33 +0000 [thread overview]
Message-ID: <49dd78620812091220l449cfcffscb791f4590c0ad0@mail.gmail.com> (raw)
In-Reply-To: <3F715C67433E594B88B5ABEBBC6EE49F03E16E84@fe-mail47.de.bosch.com>
2008/12/9 Pach Roman (DGS-EC/ESG3) <Roman.Pach@de.bosch.com>:
> I've performed following two short tests.
>
> test 1:
> -------
>
> (use-syntax (ice-9 syncase))
>
> (define-syntax my-macro-1
> (syntax-rules ()
> ((_ par1 par2 par3)
> (begin
> (string-concatenate (list par1 par2 par3))
> ))))
>
> (define (dummy)
> (my-macro-1 "a" "b" "c"))
>
> (format #t "dummy => ~s\n" (procedure-source dummy))
>
> result:
> dummy => (lambda () (string-concatenate (list "a" "b" "c")))
>
> test 2:
> -------
> (define-macro (my-macro-2 par1 par2 par3)
> (string-concatenate (list par1 par2 par3)))
>
> (define (dummy)
> (my-macro-2 "a" "b" "c")
> )
> (dummy)
> (format #t "dummy => ~s\n" (procedure-source dummy))
>
> result:
> dummy => (lambda () "abc")
>
> It seems to me the define-syntax is broken in version "1.8.2"
> or I've done something wrong.
These examples both look good to me. Which one do you think is wrong?
It may help if I point out that define-macro usage usually involves
backquoting. The define-macro version of your define-syntax example
would normally be:
(define-macro (my-macro-2 par1 par2 par3)
`(string-concatenate (list ,par1 ,par2 ,par3)))
Regards,
Neil
next prev parent reply other threads:[~2008-12-09 20:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 16:51 define-syntax Pach Roman (DGS-EC/ESG3)
2008-12-09 20:20 ` Neil Jerram [this message]
2008-12-09 20:52 ` AW: define-syntax Pach Roman (DGS-EC/ESG3)
2008-12-09 21:17 ` define-syntax Neil Jerram
2008-12-09 22:28 ` AW: define-syntax Clinton Ebadi
-- strict thread matches above, loose matches on Subject: below --
2010-06-15 20:48 define-syntax Ludovic Courtès
2010-06-15 22:06 ` define-syntax Andy Wingo
2010-06-15 22:38 ` define-syntax Ludovic Courtès
2010-06-16 7:35 ` define-syntax Marco Maggi
2010-06-18 8:39 ` define-syntax Andy Wingo
2010-06-18 14:41 ` define-syntax Marco Maggi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49dd78620812091220l449cfcffscb791f4590c0ad0@mail.gmail.com \
--to=neiljerram@googlemail.com \
--cc=Roman.Pach@de.bosch.com \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).