unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Damien Mattei <damien.mattei@gmail.com>
To: guile-user <guile-user@gnu.org>
Subject: reserved-keyword in macro
Date: Wed, 2 Feb 2022 11:13:53 +0100	[thread overview]
Message-ID: <CADEOadckTDT=fR4UaG+X8eBKc3Xn=pLi2U3w3dy2kd=-UKyOjw@mail.gmail.com> (raw)

hello,
what is the best way to use a reserved keyword in a macro (a keyword for me
not already used in scheme):
if i have multiple patterns in a macro,for example:
(define-syntax macro
  (syntax-rules ()
((_ arg1 arg2) code1)
((_ reserved-keyword arg) code2)))

now if i call the macro with (macro reserved-keyword 777) code1 is expansed
but not code2

i can merge code1 and code2 and do some inner test to check
reserved-keyword like this:

  (if (equal? (quote arg1) (quote reserved-keyword)) ;; test
which had worked in past but is there a better way like :
(define-syntax macro
  (syntax-rules (reserved-keyword)
but i can not fix it to work.

regards,
damien


             reply	other threads:[~2022-02-02 10:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-02 10:13 Damien Mattei [this message]
2022-02-02 10:33 ` reserved-keyword in macro Maxime Devos
     [not found]   ` <CADEOaddzjFbSYvVGEOkrSrjHSZvUkqC9beiRw29jbH3XHeRkZw@mail.gmail.com>
2022-02-02 13:02     ` Fwd: " Damien Mattei
2022-02-02 21:23       ` Damien Mattei
2022-02-02 21:38         ` Damien Mattei
2022-02-03  0:52           ` Vijay Marupudi
2022-02-03 10:09             ` Damien Mattei
2022-02-04  8:21               ` Damien Mattei
2022-02-04 16:24                 ` Damien Mattei
2022-02-04 16:44                   ` Maxime Devos

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='CADEOadckTDT=fR4UaG+X8eBKc3Xn=pLi2U3w3dy2kd=-UKyOjw@mail.gmail.com' \
    --to=damien.mattei@gmail.com \
    --cc=guile-user@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).