unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Dr. M. Luedde" <Mirko.Luedde@Computer.Org>
Subject: guile-tutorial does not know bounded stack size
Date: Fri, 12 Jul 2002 08:42:26 -0400	[thread overview]
Message-ID: <E17Szkg-0001x2-00@fencepost.gnu.org> (raw)

Hello!

The guile-tutorial provides an example calculating the factorial of
500.

The non-tail-recursive version from the tutorial yields a stack
overflow on my system. A tail-recursive implementation works.

Cheers, Mirko. 

D:\tmp>uname -a
uname -a
CYGWIN_NT-5.0 XPERT8302 1.3.12(0.54/3/2) 2002-07-06 02:16 i686 unknown

D:\tmp>guile
guile
guile> (version)
"1.5.6"
guile> (define (fac n) (if (= n 0) 1 (* n (fac (- n 1)))))
guile> (fac 500)
ERROR: Stack overflow
ABORT: (stack-overflow)
guile> (define (fac2 n) (define (h k l) (if (zero? k) l (h (- k 1) (* k l)))) (h n 1))
guile> (fac2 500)
122013682599111006870123878542304692625357434280319284219241358838584537315388199760549644750220328186301361647714820358416337872207817720048078520515932928547790757193933060377296085908627042917454788242491272634430567017327076946106280231045264421887878946575477714986349436778103764427403382736539747138647787849543848959553753799042324106127132698432774571554630997720278101456108118837370953101635632443298702956389662891165897476957208792692887128178007026517450776841071962439039432253642260523494585012991857150124870696156814162535905669342381300885624924689156412677565448188650659384795177536089400574523894033579847636394490531306232374906644504882466507594673586207463792518420045936969298102226397195259719094521782333175693458150855233282076282002340262690789834245171200620771464097945611612762914595123722991334016955236385094288559201872743379517301458635757082835578015873543276888868012039988238470215146760544540766353598417443048012893831389688163948746965881750450692
6365338175055478128640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
guile> 


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


             reply	other threads:[~2002-07-12 12:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-12 12:42 Dr. M. Luedde [this message]
2002-07-13  0:09 ` guile-tutorial does not know bounded stack size Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E17Szkg-0001x2-00@fencepost.gnu.org \
    --to=mirko.luedde@computer.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).