[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] Can't Pretty-print?

From: Martin Rubey
Subject: Re: [Gcl-devel] Can't Pretty-print?
Date: Thu, 14 Feb 2002 16:56:23 +0100 (MEZ)

I'm sorry, but I do not quite understand your reply. What is the
pretty-print stack?

When I debug the code, everything works fine until I reach the push the
sixth time. Then, when I ask for new-cartesian, I get the error message.

Note that

(cartesian (list '((a b) (c)) '(((a) (b)) ((c) d))))

works all right. I would expect that gcl doesn't care whether the elements
of the sets passed to cartesian are atoms or elements...

(I'm a newbie, please be patient with me)

Redefining Q_SIZE would mean recompiling, wouldn't it?


> > (cartesian (list '((a b) (c)) '( ((a) (b)) ((c) (d)))))
> >
> > (defun cartesian (sets)
> >  "Returns the Cartesian product of a list of sets
> >   Example:
> >        (CARTESIAN '((A B) (C D) (E F)))
> >          ;=> ((B C F) (B C E) (B D F) (B D E) (A C F) (A C E) (A D F) (A D
> > E))
> >   Non-recursive version.
> >   "
> >  (let ((cartesian (list nil)))
> >    (dolist (set (reverse sets))         ; reverse is only for esthetics
> >      (let ((new-cartesian nil))
> >        (dolist (elmt set)
> >          (dolist (cart cartesian)
> >            (push (cons elmt cart) new-cartesian)))
> >        (setf cartesian new-cartesian)))
> >    cartesian))
> The code as written is highly nested, and overflows the default
> "pretty-print" stack in gcl.  You can work around, at least for your
> example, by doubling the Q_SIZE and IS_SIZE #defines in h/notcomp.h.
> By default, these are 128 and 256 respectively.  Anyone have a good
> idea as to what they should be in the default distribution?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]