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

call-with-multiple-values



> Date: Mon, 17 May 93 09:07:51 +0200
> From: Christian Queinnec <queinnec@margaux.inria.fr>
> To: rrrs-authors@mc.lcs.mit.edu
> Subject: call-with-multiple-values
> Reply-To: Christian.Queinnec@inria.fr

> Playing a little with call-with-values this week-end, I wonder why this
> precise order of arguments:

>         (call-with-values values-producer function) 

I don't know what other people had in mind, but in other situations it's often
a good idea to put the function last, because it is textually large.  This
makes the program easier to read.  (ie, it makes the program mentally
tail-recursive).  Thus 

(call-with-values expression
  (lambda (ans1 ans2 ans3 ans4) 
   ... some long text....))

is probably easier to read than 


(call-with-values 
  (lambda (ans1 ans2 ans3 ans4) 
   ... some long text....
   ... some long text....
      ... some long text....
      ... some long text....
      ... some long text....
      ... some long text....
      ... some long text....
             ... some long text....
	     ... some long text....
	     ... some long text....
	   ... some long text....
	   ... some long text....)
  expression)

This is the same problem people often have with long let's and letrec's  (and
why named let is often easier to read than the corresponding letrec).

--Mitch