<div dir="ltr"><div><div><div><div><div>In some postfix languages, if a procedure returns multiple values, these values can be used directly as multiple arguments to another procedure call, i.e., they are "spliced" in the latter call.<br>
</div>In an extended Racket, this would look like this:<br></div><br>(+ (values 1 2) (values 3 4)) <br></div><div>would be equivalent to <br>(+ 1 2 3 4)<br><br></div>(map values '(0 1 2) '(a b c))<br><div>would return<br>
</div><div>'(0 a 1 b 2 c)<br><br></div><div></div><div>(call-with-values (lambda()(my-proc ....)) list)<br>would simply be <br></div><div>(list (my-proc ....))<br><br></div><div>(values (values 1 2) (values 'a 'b))<br>
</div><div>would be equivalent to <br></div><div>(values 1 2 'a 'b)<br><br>Correct me if I'm wrong, but I think all the cases where this feature should be useful currently throws an error, so it would probably break only very little.<br>
</div><div><br></div>Such a missing feature tickles me from time to time, and I often find that Racket `values' system is too cumbersome to be used more often, i.e., you need to go through stages of `call-with-values', 'let/define-values', `(apply values ....)', etc. and I often find myself not wanting to go down this road.<br>
<br></div><div>IMO, `values' is *meant* to be the way I describe above: `values' is exactly like `list', except than instead of encapsulating the values in a container, it splices them in-place.</div><br><div>
Do you see some disadvantages of using values this way?<br></div><div>For example, in some occasions, for things like<br></div><div>(define (foo x) (values x x))<br></div><div>(map + (foo '(1 2 3)))<br></div><div>it may be more difficult to infer that there are actually 2 lists in the map, but to me it's just a matter of style/taste/comments/documentation, not a matter of feature.<br>
<br></div><div></div></div>Laurent<br></div>