[racket] Void expression found

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jan 7 19:44:29 EST 2015

At Tue, 6 Jan 2015 19:05:24 -0500, Benjamin Greenman wrote:
> >
> > From a practical point of view, at the low level the implementation is
> > heavily optimized for functions that return exactly one value.
> > Functions that return a different number of values are slower.
> >
> 
> Does this mean I'm better off returning (cons a b) than (values a b)?

Probably not. In increasing order of cost:

 * return a single value
 * return multiple values
 * allocate a compound data structure (such as a pair)

The gap between the last two tends to be much bigger than the gap
between the first two.

Then again, if you create a pair and return it through multiple
bindings and returns (i.e., one allocation and many single-value
returns), it can be faster than multiple values through multiple
bindings and returns (i.e., many multiple-value returns).


Posted on the users mailing list.