<brlspam@sperience.com> wrote:
+---------------
| If I use cons directly in the syntax-rules below, then my nvpair syntax
| works as expected. But I get an unbound symbol error for c2 with the code
| below. Is this my error or a bug in the Scheme implementation I'm using?
|
| (define c2 cons)
|
| (define-syntax nvpair
| (syntax-rules ()
| ((nvpair var)
| (c2 (quote var) var))))
+---------------
I suspect it's a bug in your implementation. MzScheme handles it just fine:
% mzscheme
Welcome to MzScheme version 101, Copyright (c) 1995-99 PLT (Matthew Flatt)
> (require-library "synrule.ss") ; for R5RS macros
> (define c2 cons)
> (define-syntax nvpair
(syntax-rules ()
((nvpair var)
(c2 (quote var) var))))
> (define foo 123)
> (nvpair foo)
(foo . 123)
> (nvpair (+ 12 34))
((+ 12 34) . 46)
>
That's what you expected, right?
-Rob
-----
Rob Warnock, 41L-955 rpw3@sgi.com
Applied Networking http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. PP-ASEL-IA
Mountain View, CA 94043