From: Kaelin Colclasure <kaelin@bridge.com>
I am having difficulty with the new call-with-values procedure in
Scheme48. I am familiar with Common Lisp, so I had no trouble at all
with the (values ...) form or with the concept of multiple return
values in general. I simply cannot deduce how a procedure which
returns multiple values is to be applied using call-with-values.
Here's a typical use:
> (call-with-values (lambda () (values 3 4)) cons)
'(3 . 4)
> (receive (a b) (values 3 4)
(cons a b))
'(3 . 4)
>
It's (call-with-values THUNK CONSUMER).
RECEIVE is a macro that expands as follows:
(receive (VAR1 ...) EXP
BODY ...)
=>
(call-with-values (lambda () EXP) (lambda (VAR1 ...) BODY ...))
You get the RECEIVE macro from the RECEIVING package in S48.
-Olin
|