mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* api-control.texi (if cond case): Describe SRFI 61 cond.
* srfi-modules.texi (SRFI-61): New section. (SRFI Support): Add SRFI-61 to menu.
This commit is contained in:
parent
e5547d5fc8
commit
43ed3b697e
2 changed files with 31 additions and 0 deletions
|
@ -108,6 +108,26 @@ the @code{cond}-expression. For the @code{=>} clause type,
|
|||
the value of @var{test}. The result of this procedure application is
|
||||
then the result of the @code{cond}-expression.
|
||||
|
||||
@cindex SRFI-61
|
||||
@cindex general cond clause
|
||||
@cindex multiple values and cond
|
||||
One additional @code{cond}-clause is available as an extension to
|
||||
standard Scheme:
|
||||
|
||||
@lisp
|
||||
(@var{test} @var{guard} => @var{expression})
|
||||
@end lisp
|
||||
|
||||
where @var{guard} and @var{expression} must evaluate to procedures.
|
||||
For this clause type, @var{test} may return multiple values, and
|
||||
@code{cond} ignores its boolean state; instead, @code{cond} evaluates
|
||||
@var{guard} and applies the resulting procedure to the value(s) of
|
||||
@var{test}, as if @var{guard} were the @var{consumer} argument of
|
||||
@code{call-with-values}. Iff the result of that procedure call is a
|
||||
true value, it evaluates @var{expression} and applies the resulting
|
||||
procedure to the value(s) of @var{test}, in the same manner as the
|
||||
@var{guard} was called.
|
||||
|
||||
The @var{test} of the last @var{clause} may be the symbol @code{else}.
|
||||
Then, if none of the preceding @var{test}s is true, the
|
||||
@var{expression}s following the @code{else} are evaluated to produce the
|
||||
|
|
|
@ -40,6 +40,7 @@ get the relevant SRFI documents from the SRFI home page
|
|||
* SRFI-39:: Parameter objects
|
||||
* SRFI-55:: Requiring Features.
|
||||
* SRFI-60:: Integers as bits.
|
||||
* SRFI-61:: A more general `cond' clause
|
||||
@end menu
|
||||
|
||||
|
||||
|
@ -2685,6 +2686,16 @@ element becomes the most significant bit in the return.
|
|||
@end defun
|
||||
|
||||
|
||||
@node SRFI-61
|
||||
@subsection SRFI-61 - A more general @code{cond} clause
|
||||
|
||||
This SRFI extends RnRS @code{cond} to support test expressions that
|
||||
return multiple values, as well as arbitrary definitions of test
|
||||
success. SRFI 61 is implemented in the Guile core; there's no module
|
||||
needed to get SRFI-61 itself. Extended @code{cond} is documented in
|
||||
@ref{if cond case,, Simple Conditional Evaluation}.
|
||||
|
||||
|
||||
@c srfi-modules.texi ends here
|
||||
|
||||
@c Local Variables:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue