I think I don't understand (values) very well. I expected the
following to return '(1 2 3):

-> (list (apply values '(1 2 3)))

(list (apply values '(1 2 3)))
; result arity mismatch;
;  expected number of values not received
;   expected: 1
;   received: 3
; [,bt for context]

This, on the other hand, does:

-> (call-with-values  (lambda () (apply values '(1 2 3))     list)
'(1 2 3)

The best mental model I've been able to come up with is that (values)
returns its results vertically but most functions expect to get them
horizontally and will die if there are parallel lines of uncollected
values. Under this model (call-with-values) collects values from the Y
axis and pivots them back onto the X axis for consumption by regular
functions. This feels like a fragile analogy though.  Would someone
please fill me in on how it actually works?

Dave

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to