[plt-scheme] Why multiple values?

From: Corey Sweeney (corey.sweeney at gmail.com)
Date: Sun Dec 24 17:06:07 EST 2006

On 12/24/06, Carl Eastlund <cce at ccs.neu.edu> wrote:
> On 12/24/06, gregory.woodhouse at sbcglobal.net
> <gregory.woodhouse at sbcglobal.net> wrote:
> > In the cases like Danny's example, I've usually returned a list, as in
> >
> > (list (car x) (cdr x))
> Sure, that works too, though it allocates a list that takes up space,
> must be destructured, and is not actually relevant to the problem.

I get it!  Your saying that the compilers aren't designed to catch the fact
that the list is created, and disasembled immediately by it's calling
function, and not really needed, and therefore it creates a memory and speed
overhead, that while usually small, could be important if it's inside a
heavily used loop.

or a list to return them in.  Many programmers prefer not to construct
> an arbitrary, irrelevant structure like a list for a non-list problem,
> so they use multiple values.

And the rest prefer not to construct an arbitrary, irrelevant syntax so they
use lists ;)

But I do see your point.  I can now see why some people are using
multi-value's.  But I would argue that it should be a compiler thing, not a
syntax thing.


> Carl Eastlund
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

((lambda (y) (y y)) (lambda (y) (y y)))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20061224/edeb0d94/attachment.html>

Posted on the users mailing list.