hey. I made a thing to make profiling load times easier to figure out: https://gist.github.com/d31e7d54e8350370b141393f4afc24d6
I’ll port to racket later
is there anyway to catch a (values x y ...)
as a whole when passing it to a function?
@guannanwei ? can you explain?
for example, I have a function f
and it takes one argument, when applying (values ...)
to f
, I would like to use (values ...)
as a single variable inside of f
(call-with-values (thunk (values 1 2 3)) list) ; ‘(1 2 3)
but… I don’t think you can make a function that takes a variable number of values… hence the thunk
I do found call-with-values
but it restricts me to put values inside of lambda, I’m just looking for a more elegant way to do this
@guannanwei why do you want to apply values
as an arg? can you explain what you’re trying to do?
> It is impossible to bind the evaluated result of values expression to a single variable unlike other Scheme expressions
http://docs.racket-lang.org/srfi/srfi-86.html
Might want to check out mu/nu from 86
they look interesting
Well, I have a function that returns values
, I would like to compare the results of two applications of that function. Probably macro could do that?
(define v (values 1 2 3)) => error
(define v (lambda () (values 1 2 3))) => (lambda () (values 1 2 3))
(define m (mu 1 2 3)) => (lambda (f) (f 1 2 3))
(define a (apply values 1 '(2 3))) => error
(define a
(lambda () (apply values 1 '(2 3)))) => (lambda () (apply values 1 '(2 3)))
(define n (nu 1 '(2 3))) => (lambda (f) (apply f 1 '(2 3)))
(call-with-values v list) => (1 2 3)
(m list) => (1 2 3)
(call-with-values a list) => (1 2 3)
(n list) => (1 2 3)
so for testing? yeah… you could do that with a macro. wrap up LHS and RHS with call-with-values … list
then use check-equal?
yeah, for testing, right, for now I just put values
into a lambda and use nested call-with-values, then I could compare the equality of two lists
@zenspider anyway, SRFI–86 looks helpful, thank you!