From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.bugs Subject: Re: guile-tutorial does not know bounded stack size Date: 13 Jul 2002 01:09:26 +0100 Sender: bug-guile-admin@gnu.org Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1026519568 29432 127.0.0.1 (13 Jul 2002 00:19:28 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 13 Jul 2002 00:19:28 +0000 (UTC) Cc: bug-guile@gnu.org Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17TAdE-0007ea-00 for ; Sat, 13 Jul 2002 02:19:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17TAdv-0000aQ-00; Fri, 12 Jul 2002 20:20:11 -0400 Original-Received: from mail.uklinux.net ([80.84.72.21] helo=s1.uklinux.net) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17TAdL-0000XV-00 for ; Fri, 12 Jul 2002 20:19:35 -0400 Original-Received: from portalet.ossau.uklinux.net (ppp-0-169.lond-a-1.access.uk.tiscali.com [80.225.196.169]) (authenticated) by s1.uklinux.net (8.11.6/8.11.6) with ESMTP id g6D0F5f16351; Sat, 13 Jul 2002 01:15:05 +0100 Original-Received: from laruns.ossau.uklinux.net.ossau.uklinux.net (laruns.ossau.uklinux.net [192.168.1.3]) by portalet.ossau.uklinux.net (Postfix on SuSE Linux 7.2 (i386)) with ESMTP id CB9A71702; Sat, 13 Jul 2002 01:15:24 +0000 (GMT) Original-To: "Dr. M. Luedde" Original-Lines: 42 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Errors-To: bug-guile-admin@gnu.org X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GUILE, GNU's Ubiquitous Extension Language List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.bugs:378 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.bugs:378 >>>>> "M" == M Luedde writes: M> Hello! M> The guile-tutorial provides an example calculating the factorial of M> 500. M> The non-tail-recursive version from the tutorial yields a stack M> overflow on my system. A tail-recursive implementation works. Many thanks for the report. However, this is broadly a feature, not a bug. Unless you think that Guile should have an unlimited stack size, a non-tail-recursive factorial will always overflow the stack for a big enough number. You can examine and increase Guile's stack limit like this: guile> (debug-options 'full) show-file-name #t Show file names and line numbers in backtraces when not `#f'. A value of `base' displays only base names, while `#t' displays full names. stack 20000 Stack size limit (measured in words; 0 = no check). debug yes Use the debugging evaluator. backtrace yes Show backtrace on error. depth 20 Maximal length of printed backtrace. maxdepth 1000 Maximal number of stored backtrace frames. frames 3 Maximum number of tail-recursive frames in backtrace. indent 10 Maximal indentation in backtrace. width 79 Maximal width of backtrace. backwards no Display backtrace in anti-chronological order. procnames yes Record procedure names at definition. trace no *Trace mode. breakpoints no *Check for breakpoints. cheap yes *Flyweight representation of the stack at traps. guile> (debug-set! stack 200000) (show-file-name #t stack 200000 debug backtrace depth 20 maxdepth 1000 frames 3 indent 10 width 79 procnames cheap) guile> (fac 500) 12201368259911100687012387854230469262535743428031928421924135883858453731538819976054964475022032818630136164771482035841633787220781772004807852051593292854779075719393306037729608590862704291745478824249127263443056701732707694610628023104526442188787894657547771498634943677810376442740338273653974713864778784954384895955375379904232410612713269843277457155463099772027810145610811883737095310163563244329870295638966289116589747695720879269288712817800702651745077684107196243903943225364226052349458501299185715012487069615681416253590566934238130088562492468915641267756544818865065938479517753608940057452389403357984763639449053130623237490664450488246650759467358620746379251842004593696929810222639719525971909452178233317569345815085523328207628200234026269078983424517120062077146409794561161276291459512372299133401695523638509428855920187274337951730145863575708283557801587354327688886801203998823847021514676054454076635359841744304801289383138968816394874696588175045069! 26365338175055478128640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 guile> Is this OK, or do you think the documentation needs improving somewhere? (If you do, it would be most helpful if you could suggest a patch ...) Neil _______________________________________________ Bug-guile mailing list Bug-guile@gnu.org http://mail.gnu.org/mailman/listinfo/bug-guile