Hi, "Jason Meade" <[EMAIL PROTECTED]> writes:
> (define fact > (lambda (n) > (cond > ((= n 1) 1) > (else > (* n (fact (- n 1))))))) > > guile> (fact 69) > 171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000 > guile> (fact 70) > ERROR: Stack overflow > ABORT: (stack-overflow) Your definition of `fact' is not tail-recursive, i.e., for each recursive call, a new stack frame is created. In order to remove this problem, you have to rewrite `fact' so that it is tail-recursive (which means that the function returns immediately after the recursive call): this way Guile will not create any new stack frame for the recursive calls. See for instance the definition of `tail-factorial' there: http://sourceware.org/ml/guile/2000-06/msg00074.html . Thanks, Ludovic. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel