From the R5RS standard:
Values might be defined as follows:
(define (values . things)
(call-with-current-continuation
(lambda (cont) (apply cont things))))
My first interpretation of this was that an expression like (+ (values 1 2))
is equivalent to (apply + '(1 2))
and would yield the result 3
. But, according to my tests, this interpretation is not correct. Here is my interpretation of the code above: values
is a function taking any number of arguments, bundled into a list called things
. Then, the current continuation (the place where values
is used) is called with the list things
"unbundled".
What am I missing? The example above (+ (values 1 2))
gives an error or 1 depending on the interpreter I used.