mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
New documentation
This commit is contained in:
parent
4c517c8ef8
commit
575fdfd590
1 changed files with 23 additions and 0 deletions
23
docs/api/srfi/2.md
Normal file
23
docs/api/srfi/2.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# SRFI 2 - `and-let*`
|
||||
|
||||
The `(srfi 2)` library provides the `and-let*` macro, an `and` with local bindings.
|
||||
|
||||
Like an ordinary `and`, an `and-let*` special form evaluates its arguments -- expressions -- one after another in order, till the first one that yields `#f`. Unlike `and`, however, a non-#f result of one expression can be bound to a fresh variable and used in the subsequent expressions. `and-let*` is a cross-breed between `let*` and `and`.
|
||||
|
||||
See the [SRFI document](http://srfi.schemers.org/srfi-2/srfi-2.html) for more information.
|
||||
|
||||
- [`and-let*`](#and-let)
|
||||
|
||||
#and-let*
|
||||
(and-let* (claws) body
|
||||
|
||||
claws ::= '() | (cons claw claws)
|
||||
claw ::= (variable expression) | (expression) |
|
||||
bound-variable
|
||||
|
||||
- The `claws` are evaluated in the strict left-to-right order
|
||||
- For each `claw`, the `expression` part is evaluated first (or `bound-variable` is looked up)
|
||||
- If the result is #f, `and-let*` immediately returns #f
|
||||
- Otherwise, if the `claw` is of the form `(variable expression)` the `expression`'s value is bound to a freshly made `variable`
|
||||
- The `variable` is available for the rest of the `claws` , and the `body`
|
||||
- As usual, all `variable`s must be unique (like in `let*`)
|
Loading…
Add table
Reference in a new issue