On Sat, 2009-09-05 at 21:25 -0400, Aaron W. Hsu wrote:
> On Fri, 04 Sep 2009 19:00:32 -0400, Brian Harvey <[email protected]>  
> wrote:
> 
> > Functions have one return value, by definition.
> 
> In the purest mathematics that I have seen, they also take only one value.  
> After that, it's all just syntax, so who cares, right? Likewise, I have  
> met plenty of mathematicians who will generalize functions to returning  
> more than one value for their proofs. It's all syntax, and there is no  
> reason not to take advantage of the clarity it can provide.

In a pure mathematical sense, a function takes one argument and returns 
one value.  What we think of as functions taking multiple arguments are 
functions taking a tuple (or an environment) as an argument, and what 
we think of as functions returning multiple values are functions
returning a tuple (or an environment) as a result.

So far so good.  It's a symmetry, as you point out.  But there's an
asymmetry in our mapping of this mathematical reality into our 
language syntax, where one maps naturally onto a list form and one 
doesn't.  

The semantics of multiple returns as opposed to returning a list and 
multiple arguments as opposed to passing a list bear some deep thought.
What we wind up doing is modeling the passing of environments, and 
while lambda is good for the one direction, our return mechanisms so 
far aren't sufficiently expressive to do it.

                                Bear





_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to