<br><br><div><span class="gmail_quote">On 12/24/06, <b class="gmail_sendername">Carl Eastlund</b> <<a href="mailto:cce@ccs.neu.edu">cce@ccs.neu.edu</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 12/24/06, Corey Sweeney <<a href="mailto:corey.sweeney@gmail.com">corey.sweeney@gmail.com</a>> wrote:<br>><br>> And the rest prefer not to construct an arbitrary, irrelevant syntax so they<br>> use lists ;)
<br>><br>> But I do see your point. I can now see why some people are using<br>> multi-value's. But I would argue that it should be a compiler thing, not a<br>> syntax thing.<br><br>Scheme has multiple inputs without resorting to lists (for functions
<br>of fixed input size), so having the same thing for outputs isn't<br>really arbitrary or irrelevant. </blockquote><div><br>heh. Multiple inputs is generally a arbitrary syntax too. I basically see "(define (my-function a b c) {blah}))" as syntactic sugar for:
<br><br>"(define my-function (lambda (a) (lambda (b) (labmda (c) {blah}))))"<br><br>Your function "{blah}" works the same either way. Also "(my-function x y z)" would be syntacitic sugar for "(((my-function x) y) z)".
<br>The only differnce from the users perspective is that when implemented as "multi input values syntax" instead of a "bunch of lambdas syntax", then the interpreter can check for arity errors when calling.
I.E. in the "bunch of lambdas syntax" method, (define add-two (+ 2)) becomes a valid function, but in the multi input values syntax method (define add-two (+ 2)) throws a arity error and says that it can't work without 2 parameters, so you need to do: (define add-two (lambda (x) (+ 2 x))).
<br><br><br>However I usually use the "multi value syntax", because in normal R5RS intrepeters, "(my-function x y z)" is not syntacitic sugar for "(((my-function x) y) z)".<br><br><br>in the "bunch of lambda functions syntax" any result list of length 3 or less can be "folded" into my-function. in "multi input values syntax" you get arity errors.
<br><br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Lists (linear, arbitrary-size,<br>usually homogenous data structures), on the other hand, are not a
<br>close fit (for flat, fixed-size, often heterogenous function outputs).<br><br>Anyway, this isn't (just) an efficiency issue. It's a matter of what<br>the programmer can express. Multiple values says "this program
<br>outputs these two things". Lists say "this program outputs a list".</blockquote><div><br>I think were settled on the effiency issue, but I'm not seeing the non-effencity issue in this one. Are you saying that when i have a set of numbers, that i'm actually saying "i have a set of numbers, not a list of numbers with special set properties added to them"?
I.E. like we should add set as a new primative because I want to name it differntly then "list of numbers with special set properties"? If we've discarded effencicy issues, then we shouldn't need such a thing, right?
<br><br>Corey<br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Multiple values aren't my favorite program construct either, but I
<br>think we've covered the ground of why they exist as they are.<br><br>--<br>Carl Eastlund<br></blockquote></div><br><br>-- <br>((lambda (y) (y y)) (lambda (y) (y y)))