[plt-scheme] send/suspend return values

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Nov 21 16:17:17 EST 2004

On Nov 21, 2004, at 10:11 AM, David J. Neu wrote:

> I'm wondering if it's possible to have the procedure that is the
> argument to a send/suspend call (i.e. the procedure MAKE-FORM in the
> example below), return multiple values, e.g. the HTML and the list of
> data.

v208p1:

No. When you can (send/suspend f), send/suspend does not invoke f in 
tail-position. Instead it names the result and makes sure it is a 
response. I have to admit that after looking at the code I find it way 
too defensive. The author should have instead stated the contract of 
send/suspend as

  (String -> X) -> X

which would then allow f to return multiple values.

;; ---

Having said that, I don't understand your example however. I believe, 
like Jordan, that you already traverse the data more than once. If your 
sample code is really representative and your goal is to get these 
large list of "random" things directly into a web page (which is 
different from the above), you need to perform a loop fusion manually 
(aka deforestation). That would be a nice refactoring transformation 
for DrScheme but right now it is not.

-- Matthias




Posted on the users mailing list.