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


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 ...))))


	(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

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))))