This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Ticket 87: Allow multiple producers in `call-with-values`

2011-01-24 06:47:32
WG1 - Core
alexshinn
major
cowan
wontfix
source
closed
2010-10-18 11:33:51
defect

In R5RS and R6RS, call-with-values takes two arguments, both procedures. The first is a producer of multiple values; the second is a consumer, to which the multiple values returned by producer are passed as arguments.

I propose allowing multiple producer arguments. This gives call-with-values the same power as Common Lisp multiple-value-call.

As an example, imagine an implementation of (physical) vectors, called vecs, using multiple values. To create a vec, we use make-vec, defined thus:

(define (make-vec x y z) (values x y z))

Then we can add vecs as follows:

(define (vec+ x1 y1 z1 x2 y2 z2) (make-vec (+ x1 y1) (+ x2 y2) (+ x3 y3))) (define-syntax vecplus () (syntax-rules ((vecplus a b) (call-with-values a b vec+)))) (vecplus (make-vec 1 2 3) (make-vec 4 5 6) => 5 7 9

Cross product, dot product, and so on can be implemented in the same style. In Scheme implementations where multiple values are put on the stack, this allows operations on vecs without boxing or unboxing them.

resolutionwontfix
statusnewclosed

WG1 voted to reject multiple producers.