From: Matt Birkholz Date: Sat, 5 Nov 2016 06:12:40 +0000 (-0700) Subject: Update documentation for values, call-with-values. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=refs%2Fheads%2Fmultiple-values;p=mit-scheme.git Update documentation for values, call-with-values. --- diff --git a/doc/ref-manual/procedures.texi b/doc/ref-manual/procedures.texi index f5f609261..d63793d88 100644 --- a/doc/ref-manual/procedures.texi +++ b/doc/ref-manual/procedures.texi @@ -448,26 +448,29 @@ extent of a call to @var{before} or @var{after} is undefined. The following two procedures support multiple values. -@deffn procedure call-with-values thunk procedure +@deffn procedure values object @dots{} +Returns multiple values. The continuation in effect when this procedure +is called must accept as many values as there are @var{object}s. +@end deffn + +@deffn procedure call-with-values producer consumer @cindex multiple values, from procedure @cindex values, multiple -@var{Thunk} must be a procedure of no arguments, and @var{procedure} -must be a procedure. @var{Thunk} is invoked with a continuation that -expects to receive multiple values; specifically, the continuation -expects to receive the same number of values that @var{procedure} -accepts as arguments. @var{Thunk} must return multiple values using the -@code{values} procedure. Then @var{procedure} is called with the -multiple values as its arguments. The result yielded by @var{procedure} -is returned as the result of @code{call-with-values}. -@end deffn -@deffn procedure values object @dots{} -Returns multiple values. The continuation in effect when this procedure -is called must be a multiple-value continuation that was created by -@code{call-with-values}. Furthermore it must accept as many values as -there are @var{object}s. +Calls @var{producer} with no arguments and a continuation that, when +passed some values, calls @var{consumer} with those values as +arguments. The continuation for the call to @var{consumer} is the +continuation of the call to @code{call-with-values}. @end deffn +@example +(call-with-values (lambda () (values 4 5)) + (lambda (a b) b)) @result{} 5 +@end example +@example +(call-with-values * -) @result{} -1 +@end example + @node Application Hooks, Generic Dispatch, Continuations, Procedures @section Application Hooks