[Prev][Next][Index][Thread]

Re: small Q



Brian Campbell <Brian_Campbell@lotus.com> writes:
> Since I'm comming from a long history of one return value programming
> languages (Scheme R4RS, SmallTalk, C, Java, PASCAL, etc.), could someone
> describe where multiple return values would be useful and not just a
> convenience?

Or you could ask the conjugate (?) question: "could someone describe
where multiple function parameters would be useful and not just a
convenience?" ;)

But seriously, I found it very useful in decomposing large-ish driver
loops. The right combination of call/cc and call-with-values allows
you to capture the state of a computation right at the beginning of a
loop so you can 'continue' (in the C sense) the loop from somewhere
deeper in the call tree. This removes a lot of unecessary data
structure creation/analysis that would otherwise make me reluctant to
refactor a large function.

To be fair, certain aspects of doing this feel like cheating with
gotos. You also have to be especially careful about side-effects
(because of the call/cc), but since I strive for a highly-functional
programming style in Scheme those were not large problems.

david rush
-- 
Java is a WORA language! (Write Once, Run Away)
	-- James Vandenberg (on progstone@egroups.com)



Follow-Ups: References: