summaryrefslogtreecommitdiff
path: root/doc/ref/api-control.texi
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2006-06-17 23:15:59 +0000
committerKevin Ryde <user42@zip.com.au>2006-06-17 23:15:59 +0000
commit23f2b9a3de013f093c5913aa381219f09353c676 (patch)
tree3a3315e24402e90d9c4094f18ac7ab6c2047f31f /doc/ref/api-control.texi
parenta4f1c77ddb2057ca630b8bed9be437bdbc5dc552 (diff)
downloadguile-23f2b9a3de013f093c5913aa381219f09353c676.tar.gz
merge from 1.8 branch
Diffstat (limited to 'doc/ref/api-control.texi')
-rw-r--r--doc/ref/api-control.texi30
1 files changed, 22 insertions, 8 deletions
diff --git a/doc/ref/api-control.texi b/doc/ref/api-control.texi
index 424ce4507..3d1549ecf 100644
--- a/doc/ref/api-control.texi
+++ b/doc/ref/api-control.texi
@@ -544,20 +544,34 @@ of the call to @code{call-with-values}.
@end deffn
In addition to the fundamental procedures described above, Guile has a
-module which exports a syntax called @code{receive}, which is much more
-convenient. If you want to use it in your programs, you have to load
-the module @code{(ice-9 receive)} with the statement
+module which exports a syntax called @code{receive}, which is much
+more convenient. This is in the @code{(ice-9 receive)} and is the
+same as specified by SRFI-8 (@pxref{SRFI-8}).
@lisp
(use-modules (ice-9 receive))
@end lisp
@deffn {library syntax} receive formals expr body @dots{}
-Evaluate the expression @var{expr}, and bind the result values (zero or
-more) to the formal arguments in the formal argument list @var{formals}.
-@var{formals} must have the same syntax like the formal argument list
-used in @code{lambda} (@pxref{Lambda}). After binding the variables,
-the expressions in @var{body} @dots{} are evaluated in order.
+Evaluate the expression @var{expr}, and bind the result values (zero
+or more) to the formal arguments in @var{formals}. @var{formals} is a
+list of symbols, like the argument list in a @code{lambda}
+(@pxref{Lambda}). After binding the variables, the expressions in
+@var{body} @dots{} are evaluated in order, the return value is the
+result from the last expression.
+
+For example getting results from @code{partition} in SRFI-1
+(@pxref{SRFI-1}),
+
+@example
+(receive (odds evens)
+ (partition odd? '(7 4 2 8 3))
+ (display odds)
+ (display " and ")
+ (display evens))
+@print{} (7 3) and (4 2 8)
+@end example
+
@end deffn