[r6rs-discuss] multiple values and mathematicians
Jed Davis
jld at ccs.neu.edu
Thu Feb 19 15:11:59 EST 2009
On Thu, Feb 19, 2009 at 11:51:44AM -0600, Alan Watson wrote:
>
> While you're right that Brian's suggestion failed in the trivial case
> of (values x), I think you can write values and call-with-values in
> terms of other primitives given suitable records.
>
> values: If values is called with one argument, return it. Otherwise,
> wrap the arguments in a "values record".
>
> call-with-values: If the producer returns a "values record", unwrap it
> to obtain the values and call the consumer with them. Otherwise call
> the consumer with the value returned by the producer.
Why should there be "multiple value return records" for functions not
returning exactly one value, but not also "multiple value argument
records" for functions not taking exactly one value?
Or, since this is about mathematicians: what is there in any common
mathematical definition of "function" from which such a differentiation
would necessarily arise?
Note that values is definable in terms of call/cc according to
R[56]RS, and call-with-values is essentially the inverse of delimited
continuation capture.
But isn't this an old and well-travelled discussion by now?
--
(let ((C call-with-current-continuation)) (apply (lambda (x y) (x y)) (map
((lambda (r) ((C C) (lambda (s) (r (lambda l (apply (s s) l)))))) (lambda
(f) (lambda (l) (if (null? l) C (lambda (k) (display (car l)) ((f (cdr l))
(C k))))))) '((#\J #\d #\D #\v #\s) (#\e #\space #\a #\i #\newline)))))
More information about the r6rs-discuss
mailing list