unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Parameters
@ 2008-02-04 13:51 Sebastian Tennant
  2008-02-04 14:28 ` Parameters Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastian Tennant @ 2008-02-04 13:51 UTC (permalink / raw)
  To: guile-user

Hi list,

No doubt something of a newbie question this...

This simple procedure behaves as expected, i.e., it provides the sum of
a list of numbers:

 (define add
   (lambda (l)
     (if (null? l)
         0
       (+ (add (cdr l)) (car l)))))

whereas this procedure results in a stack overflow:

 (define add
   (lambda l
     (if (null? l)
         0
       (+ (add (cdr l)) (car l)))))

the only difference being the designation of the formal parameter of the
anonymous procedure; l or (l).

Why is this?

Regards,

Sebastian





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-02-04 17:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-04 13:51 Parameters Sebastian Tennant
2008-02-04 14:28 ` Parameters Ludovic Courtès
2008-02-04 15:05   ` Parameters Sebastian Tennant
2008-02-04 15:29     ` Parameters Chusslove Illich
2008-02-04 15:45       ` Parameters Sebastian Tennant
2008-02-04 15:47     ` Parameters Ludovic Courtès
2008-02-04 17:22       ` Parameters Sebastian Tennant

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).