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.

Source for ticket #87

cc


    

changetime

2011-01-24 06:47:32

component

WG1 - Core

description

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`.

id

87

keywords


    

milestone


    

owner

alexshinn

priority

major

reporter

cowan

resolution

wontfix

severity


    

status

closed

summary

Allow multiple producers in `call-with-values`

time

2010-10-18 11:33:51

type

defect

Changes

Change at time 2011-01-24 06:47:32

author

cowan

field

comment

newvalue

WG1 voted to reject multiple producers.

oldvalue

2

raw-time

1295822852000000

ticket

87

time

2011-01-24 06:47:32

Change at time 2011-01-24 06:47:32

author

cowan

field

resolution

newvalue

wontfix

oldvalue


    

raw-time

1295822852000000

ticket

87

time

2011-01-24 06:47:32

Change at time 2011-01-24 06:47:32

author

cowan

field

status

newvalue

closed

oldvalue

new

raw-time

1295822852000000

ticket

87

time

2011-01-24 06:47:32

Change at time 2010-10-18 11:42:10

author

cowan

field

comment

newvalue

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.

oldvalue

1

raw-time

1287376930000000

ticket

87

time

2010-10-18 11:42:10