[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] Can't Pretty-print?
From: |
Camm Maguire |
Subject: |
Re: [Gcl-devel] Can't Pretty-print? |
Date: |
14 Feb 2002 09:46:17 -0500 |
Greetings!
Martin Rubey <address@hidden> writes:
> The following produces an obscure error message in gcl 2.5.0
> (not so in clisp)
>
> (or is the code bad?)
>
> (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?
Take care,
>
>
>
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah