[taos-glug] idle curiosity about factorials
- From: Philip Ansteth <pansteth@xxxxxxxxxxx>
- To: taos-glug@xxxxxxxxxxxxx
- Date: Wed, 2 Jul 2003 16:20:30 -0600
I tried the following program:
(define fact
(lambda (n)
(if (= n 0)
1
(* n (fact (- n 1))))))
On my Debian Gnu/Linux system,
running Guile 1.4,
(fact 360) works. But (fact 361) generates
ERROR: Stack overflow
So do other values larger than 360.
Alternately, on my Windows Me notebook, running CMUScheme,
the same program gave no error on selected values
up through (fact 3600).
I'm curious whether other other people get the same
"Stack overflow" error on their systems.
I suspect I'm failing to set some configuration option on
guile. Or maybe something about my hardware? The program came
from the "guile-tutorial" that I access with "info guile-tutorial"
at the shell prompt. (There it's called "recursive-factorial," but
that was too much to type over and over.)
Oddly, the tutorial shows (fact 500) working. That's why I suspect
I'm doing something wrong.
Philip
P.S.
(fact 10000) on the Windows Me notebook worked--or a least returned without
an error message.
- Follow-Ups:
- [taos-glug] Re: idle curiosity about factorials
- From: Jonathan Bartlett
Other related posts:
- » [taos-glug] idle curiosity about factorials
- » [taos-glug] Re: idle curiosity about factorials
- [taos-glug] Re: idle curiosity about factorials
- From: Jonathan Bartlett