unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Sebastian Tennant <sebyte@smolny.plus.com>
To: guile-user@gnu.org
Subject: Parameters
Date: Mon, 04 Feb 2008 15:51:49 +0200	[thread overview]
Message-ID: <87lk603k3u.fsf@moley.moleskin.org> (raw)

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





             reply	other threads:[~2008-02-04 13:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-04 13:51 Sebastian Tennant [this message]
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

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=87lk603k3u.fsf@moley.moleskin.org \
    --to=sebyte@smolny.plus.com \
    --cc=guile-user@gnu.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).