Email list hosting service & mailing list manager

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 John David Stone 02 Jul 1999 18:32 UTC

Lars Thomas Hansen writes:

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

        Actually, the functionality doesn't quite match, since RECEIVE can
also accommodate variable-arity formals.  For instance, you can define a
very general kind of procedure compostion thus:

            (define (compose outer inner)
              (lambda arguments
                (receive intermediates (apply inner arguments)
                  (apply outer intermediates))))

Both OUTER and INNER can have any arity and return any number of values.

--
======  John David Stone - Lecturer in Computer Science and Philosophy  =====
==============  Manager of the Mathematics Local-Area Network  ==============
==============  Grinnell College - Grinnell, Iowa 50112 - USA  ==============
========  xxxxxx@cs.grinnell.edu - http://www.cs.grinnell.edu/~stone/  =======