* syntax-rules and conditional define
@ 2003-02-14 22:49 Kevin Ryde
0 siblings, 0 replies; only message in thread
From: Kevin Ryde @ 2003-02-14 22:49 UTC (permalink / 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-02-14 22:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-14 22:49 syntax-rules and conditional define Kevin Ryde
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).