Subject: Re: iterative <-> recursive programming
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 23 Dec 2000 05:21:31 GMT
Newsgroups: comp.lang.scheme
Message-ID: <921cor$fro7u$1@fido.engr.sgi.com>
Joe Marshall  <jrm@content-integrity.com> wrote:
+---------------
| "KLH" <klh@sedona.net> writes:
| > What makes it tail recursive?
| 
| That's actually pretty tricky to explain concisely.
+---------------

Yes, though R5RS section "3.5 Proper tail recursion" does a reasonable job:

    <URL:http://www.schemers.org/Documents/Standards/R5RS/r5rs_22.html#SEC24>

It defines the notion of a "tail context", and then inductively enumerates
the tail contexts of an expression that is in a tail context. For example,
if "(if foo bar baz)" is in a tail context, then "bar" and "baz" are in
tail contexts, but "foo" is not. And so on.


-Rob

-----
Rob Warnock, 31-2-510		rpw3@sgi.com
Network Engineering		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		PP-ASEL-IA
Mountain View, CA  94043