Subject: Re: Iteration...
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 28 Mar 2001 03:02:37 GMT
Newsgroups: comp.lang.scheme
Message-ID: <99rk8d$4nnnv$1@fido.engr.sgi.com>
<schluum@yahoo.com> wrote:
+---------------
| can anyone tell me if there are instinaces  in scheme where you can
| have multiple exit points of an iterative loop?
...
| can anyone show me how to code this?
+---------------

Yes, and yes. The "named let" construct is ideally suited to that.
See the second half of <URL:http://www.schemers.org/Documents/Standards/
R5RS/HTML/r5rs-Z-H-7.html#%_sec_4.2.4> for a example. Note that the
use of a "cond" inside the named-let is quite common, and that any
branch of the cond which *doesn't* (tail-)recursively call the named-let
procedure is an "exit" of the loop, thus providing an arbitrary number
of distinct exit cases.


-Rob

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