[comp.lang.scheme] extend-syntax

bobg+@andrew.cmu.edu (Robert Steven Glickstein) (03/20/89)

I'm just getting started with Scheme and I have MIT's CScheme, release 6.1.2
(microcode 10.2, runtime 13.91, sf 3.13).  I've been reading Dybvig's "The
Scheme Programming Language", and I'd like to try out some of the examples in
Dybvig's book.  Dybvig's Scheme ("Chez Scheme") differs from CScheme in that
CScheme does not have the "extend-syntax" function.  Does anyone have a R3RS
definition of extend-syntax?

Thanks in advance,

-Bob Glickstein
-Information Technology Center, Carnegie Mellon University, Pittsburgh, PA

hohendor@lan.informatik.tu-muenchen.dbp.de (Christian Hohendorf) (08/31/90)

Hello experts,

I have ported "extend-syntax", a kind of easy-to-understand macro replacement,
the MacScheme code of which came across the net some years ago, to some other
scheme implementations. Now I'm having trouble replacing macros by extend-
syntax (for compatibility's sake). In my opinion, the following should work:

(let ((var '()))
  (extend-syntax (test)
                 ((test) var)
                 ((test q) (set! var (cons 1 var)))
                 ((test q w) (set! var (cons 2 var)))
                 ((test q w e) (set! var (cons 3 var))))))

Calling the macth parameters, extend-syntax claims var not to be bound
  (except when it is also defined globally).

- When calling test without parameters, and var defined globally, extend-syntax
  tries to evaluate the list bound to var. When replacing the corresponding
  line with ((test) 'var), just the symbol var is returned. But I want the non-
  evaluated list bound to that symbol.

Unfortunately, I don't have access to Ken Dybvig's book about Scheme, and I'm
running out of time a bit. Any hints would be heavily appreciated.

Thanks in advance,
     Chris


--
Christian Hohendorf                  hohendor@lan.informatik.tu-muenchen.dbp.de