RECEIVE vs LET-VALUES Lars Thomas Hansen (02 Jul 1999 17:38 UTC)
RECEIVE vs LET-VALUES John David Stone (02 Jul 1999 18:30 UTC)
Re: RECEIVE vs LET-VALUES Lars Thomas Hansen (02 Jul 1999 18:41 UTC)
Re: RECEIVE vs LET-VALUES John David Stone (02 Jul 1999 18:48 UTC)

RECEIVE vs LET-VALUES Lars Thomas Hansen 02 Jul 1999 17:38 UTC

Rob Warnock says he prefers LET-VALUES to both RECEIVE and
MULTIPLE-VALUE-BIND and laments that MzScheme has a different LET-VALUES
form already.

I agree that LET-VALUES is preferable to RECEIVE, which I think is
somewhat of a misnomer since e.g. LET and LAMBDA receive values as much
as any other forms do.

A definition of LET-VALUES that is compatible with the MzScheme syntax
and that accomplishes the same as RECEIVE is easily defined, however:

	(define-syntax LET-VALUES
	  (syntax-rules ()
	    ((LET-VALUES (?variables ?expr) ?body1 ?body2 ...)
	     (receive ?variables ?expr ?body1 ?body2 ...))))

e.g.,

	(let-values ((fore aft) (partition (precedes pivot) others))
	  (append (qsort fore) (cons pivot (qsort aft))))

If this change is made to SRFI 8, and if MzScheme is changed to support
SRFI 8, then no working MzScheme programs would experience a change in
meaning.

John Stone is concerned about the horizontal space cost of a long name,
and LET-VALUES and the extra set of brackets are 5 characters longer
than RECEIVE.  The bracketing of variables and expression suggest a
vertical layout that reclaims some of the space lost:

	(let-values ((fore aft)
		     (partition (precedes pivot) others))
	  (append (qsort fore) (cons pivot (qsort aft))))

--lars