(values->list (values 1 2 3)) = (list 1 2 3)
It can't be a function; a function-argument continuation only accepts a
single value.
As to why prefer a macro instead of a function like 'call/values->list',
I think 'values->list' represents a smaller, more coherent bit of
behavior. You can trivially wrap it around arbitrary expressions instead
of just function calls.
Ryan
On 04/28/2014 01:45 PM, Matthias Felleisen wrote:
Time to move it to a place easy to find? But why a macro?
On Apr 28, 2014, at 1:10 PM, Ryan Culpepper <ry...@ccs.neu.edu> wrote:
On 04/28/2014 10:08 AM, Laurent wrote:
On Mon, Apr 28, 2014 at 3:47 PM, Matthias Felleisen
<matth...@ccs.neu.edu <mailto:matth...@ccs.neu.edu>> wrote:
[...]
Why not something like `apply->list` or `apply/list`?
(personally I usually call it `cvl` for call/values->list, but that's
because I often use it on the command line, which makes going from `(foo
'a 'b 'c)` to `(cvl foo 'a 'b 'c)` effortless)
(define (nth-return-value i f . s)
(call-with-values
(lambda () (apply f s))
(lambda l (list-ref l i))))
unstable/list has an unexported 'values->list' macro that takes an expression
and returns the list of values it produces.
Ryan
_________________________
Racket Developers list:
http://lists.racket-lang.org/dev
_________________________
Racket Developers list:
http://lists.racket-lang.org/dev