Subject: [clisp-list] Stack size problem

From: Miguel Gonçalves <[email-masked]>
Date: Fri Jan 4 19:15:03 2002

Hello!

On the Microsoft Windows platform the stack is too small when compared to 
GNU/Linux installations.

Can it be increased in any way without recompiling CLISP?

Are there interesting Common Lisp commands regarding the stack I should be 
aware of?

Best regards,
Miguel Gonçalves

---

From: Sam Steingold <[email-masked]>
Date: Sat Jan 5 07:44:01 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] Stack size problem"
> * Sent on Sat, 05 Jan 2002 03:14:16 +0000
> * Honorable Miguel Gonçalves <[email-masked]> writes:
>
> On the Microsoft Windows platform the stack is too small when compared
> to GNU/Linux installations.
> 

editbin /stack:3145728 lisp.exe

> Are there interesting Common Lisp commands regarding the stack I should
> be aware of?

<http://clisp.cons.org/impnotes.html#debugger>

-- 
Sam Steingold (http://www.podval.org/~sds)
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
All extremists should be taken out and shot.

---

From: Miguel Gonçalves <[email-masked]>
Date: Sat Jan 5 13:16:03 2002

After running the editbin command exactly as you suggested I got this:

[1]> (defun fact (n)
    (if (> n 0)
       (* n (fact (- n 1)))
       1))
FACT

[2]>
(fact 5000)

*** - Program stack overflow. RESET
[3]>

What might be the problem? Is it CLISP or Windows? I tried the same 
function with DrScheme and managed to calculate (fact 20000) so I think 
it's not a Windows problem.

TIA,
Miguel

---

From: Miguel Gonçalves <[email-masked]>
Date: Sat Jan 5 15:08:03 2002

Please ignore my previous message (quoted bellow) as I found out that the 
editbin program expects

/STACK instead of /stack (it is case sensitive).

BTW, why running (fact 250000) (that's a huge number :) I am just trying 
out LISP's mathematical capabilities as I intend to use it very soon for a 
project that involves lots of mathematics) in non-compiled mode CLISP 
aborts with:

C:\CLISP>clisp factorial.lsp

C:\CLISP>c:\clisp\lisp.exe -m 128MB -M c:\clisp\lispinit.mem -B c:\clisp 
factori
al.lsp

*** - Lisp stack overflow. RESET

and running with the -C flag (id est, compiling before running) it all goes 
well (it completes the calculation in about 60 seconds -- real time)?

Best regards,
Miguel

---

From: Sam Steingold <[email-masked]>
Date: Sat Jan 5 17:20:01 2002

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] Stack size problem"
> * Sent on Sat, 05 Jan 2002 23:06:52 +0000
> BTW, why running (fact 250000) (that's a huge number :) I am just
> trying out LISP's mathematical capabilities as I intend to use it very
> soon for a project that involves lots of mathematics) in non-compiled
> mode CLISP aborts with:
> 
> and running with the -C flag (id est, compiling before running) it all
> goes well (it completes the calculation in about 60 seconds -- real
> time)?

compiled code is faster and uses less stack - are you surprised?

note that your implementation of factorial is very inefficient.
see CLOCC/CLLIB/math.lisp (product-from-to, fibonacci &c)
<http://www.podval.org/~sds/data/cllib.html>

note also that CLISP has some mathematical functions built-in.
<http://clisp.cons.org/impnotes.html#d39e4421>

-- 
Sam Steingold (http://www.podval.org/~sds)
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
Your mouse has moved - WinNT has to be restarted for this to take effect.