From: Kevin Ryde <user42@zip.com.au>
Subject: syntax-rules and conditional define
Date: Sat, 15 Feb 2003 08:49:22 +1000 [thread overview]
Message-ID: <8765rmtr4d.fsf@zip.com.au> (raw)
In guile 1.6.3 on a recent i386 debian, I thought to make myself a
"define if not already defined" using
(use-modules (ice-9 syncase))
(define-syntax define-maybe
(syntax-rules ()
((define-maybe name value)
(if (not (defined? 'name))
(define name value)))))
(define-maybe x 123)
but run with "guile -s foo.scm" gives
/down/guile/usr/share/guile/1.6/ice-9/syncase.scm:130:16: In procedure scm-error in expression (scm-error (quote misc-error) who ...):
/down/guile/usr/share/guile/1.6/ice-9/syncase.scm:130:16: invalid context for definition of x
I guess I'm not sure if this is a bug, but
(if (not (defined? 'x))
(define x 123))
worked at the top-level, so I thought perhaps it could be expected to
in a macro too.
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile
reply other threads:[~2003-02-14 22:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=8765rmtr4d.fsf@zip.com.au \
--to=user42@zip.com.au \
/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).