Hi.

In Paradigms of AI Programming Peter Norvig describes a possible implementation of queues. You can find his source code in http://www.norvig.com/paip/auxfns.lisp. This code corresponds to what he wrote with Richard C Walters in ACM Lisp Pointers on the same topic.

Now, when I execute his code from the REPL of SBCL 1.1.3 on MacOS 10.6.8 I get a control-stack exhaustion (see below). The code is taken straight from the file posted Peter Norvig. Am I missing something?

Thanks,
--Christian

=== Snapshot of what's displayed on my machine:

$ sbcl
This is SBCL 1.1.3, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (defvar q)

Q
* (defun make-queue ()
  "Build a new queue, with no elements."
  (let ((q (cons nil nil)))
    (setf (car q) q)))

MAKE-QUEUE
* (setq q (make-queue))

(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
[...]
debugger invoked on a SB-KERNEL::CONTROL-STACK-EXHAUSTED:
  Control stack exhausted (no more space for function call frames).
This is probably due to heavily nested or infinitely recursive function
calls, or a tail call that SBCL cannot or has not optimized away.