From: Kent M Pitman
Subject: Re: And i thought scheme is a subset of lisp.
Date: 
Message-ID: <sfwr9is5l41.fsf@world.std.com>
Lieven Marchand <···@bewoner.dma.be> writes:

> Deepak Goel <·····@Glue.umd.edu> writes:
> 
> > I had a strange experience --- i just discovered that  letrec is not
> > defined in LISP, though it's defined in scheme. I always used to think
> > that scheme is like a subset of lisp. 

This isn't even close to true.  Scheme is only superficially similar to
CL and shares some cultural roots.  It semantics is in numerous ways very
different and thinking of it as a subset will confuse you probably more
often than you expect on more issues than just this one.

> LABELS does approximately the same job.

Or you may want to compute the value to which to bind the variable to,
instead of using a statically declared value to which a function binding
will be made, in which case you'll need to do:

 (defmacro letrec (bindings &body forms)
   `(let ,(mapcar #'(lambda (binding) `(,(car binding) nil)) bindings)
      (setq ,@(mapcan #'copy-list binding))
      nil ; in case of no body
      ,@forms))

I didn't test this code, but think offhand it will do pretty much what
Scheme will do with letrec.  I also think there are Scheme implementations
that implement letrec in almost exactly this way (the expansion of the 
letrec, I mean, not the CL source code).